public
Description: Use ANSI codes in printed output, including colors and controlling the cursor, clearing the line, and clearing the screen.
Homepage: http://blog.stevensoroka.ca
Clone URL: git://github.com/ssoroka/ansi.git
ssoroka (author)
Mon Dec 15 16:01:47 -0800 2008
commit  c0316255508c72c025e14b624685a729881ea8ef
tree    327618ed745ff3fda13c525ef77db5755dc4c745
parent  3caf1b0c27a181da907e7fa36e1643c2b44a3b9f
ansi /
name age message
file .gitignore Wed Nov 12 00:45:41 -0800 2008 first [ssoroka]
file README.rdoc Mon Dec 15 16:01:47 -0800 2008 typo fix [ssoroka]
file Rakefile Wed Nov 12 01:16:29 -0800 2008 increment version [ssoroka]
file ansi.gemspec Wed Nov 12 01:20:17 -0800 2008 new gemspec [ssoroka]
file init.rb Wed Nov 12 01:07:32 -0800 2008 docs, plugin stuff [ssoroka]
directory lib/ Wed Nov 12 00:45:41 -0800 2008 first [ssoroka]
directory test/ Wed Nov 12 00:45:41 -0800 2008 first [ssoroka]
README.rdoc

ANSI

DESCRIPTION

Use ANSI codes in printed output, including colors and controlling the cursor, clearing the line, and clearing the screen.

INSTALLATION

as a gem:

  sudo gem install ssoroka-ansi

as a plugin:

  script/plugin install git://github.com/ssoroka/ansi.git

USAGE

require ‘ansi’ # if not installed as a plugin.

1) Simply control the cursor:

  >> puts "HELLO" + ANSI.right(30) + "THERE!"
  HELLO                              THERE!

2) use colors:

  >> puts ANSI.color(:red) { "hello there" }
  >> puts ANSI.color(:green) + "Everything is green now" + ANSI.no_color

3) loops:

  printf ANSI.clear_screen
  puts "Processing users..."
  max = User.count
  User.all.each_with_index {|user, index|
    user.update_something!
    printf ANSI.left(50) + "Processed #{index}/#{max} users..."
  }
  puts " done!"