NetAdminTools.com
 
Categories:
GNU/Linux | Homebrew designs | Perl | Ruby | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | ERP | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Ruby
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·ERP
·REALbasic
·All Categories


Ruby Loops and ANSI Color
Topic:Ruby   Date: 2010-11-14
Printer Friendly: Print   Mobile View: mobile

spacerspacer
<<  <   >  >>

Subject

Here is a quick little script to illustrate loops and the Term-Ansicolor gem:

require "rubygems"
require "term/ansicolor"
c = Term::ANSIColor
print c.white,c.bold,c.on_blue
print "                                           "
puts
for w in 
[ "words","in","an","array" ]
	print "   "+w
end
print "                                           "
print c.reset
print "\n"

I originally made this because wanted to create a graphic with monospaced letters and color for a game called "5X5X5 Rules". This is what it looks like when I use the rules. I wanted the wider border, which is the reason for the extra print and puts statements above:


People:
Places:
Things:
loop
ruby
Converting a Rails App to present with GTK
ansicolor
Times:





Please read our Terms of Use and our Privacy Policy
Microsoft, Windows, Windows Server are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2013 NetAdminTools.com