Set of ANSI Code based classes and modules for Ruby
See the codeThe ANSI project is a collection of ANSI escape code related libraries enabling ANSI code based colorization and stylization of output. It is very nice for beautifying shell output.
This collection is based on a set of scripts spun-off from Ruby Facets. Included are Code (used to be ANSICode), Logger, ProgressBar and String. In addition the library includes Terminal which provides information about the current output device.
There are a number of modules and classes provided by the ANSI package. To get a good understanding of them it is best to pursue the QED documents or the API documentation.
At the heart of all the provided libraries lies the ANSI::Code module which defines ANSI codes as constants and methods. For example:
require 'ansi/code'
ANSI.red + "Hello" + ANSI.blue + "World"
=> "\e[31mHello\e[34mWorld"
Or in block form.
ANSI.red{ "Hello" } + ANSI.blue{ "World" }
=> "\e[31mHello\e[0m\e[34mWorld\e[0m"
The methods defined by this module are used throughout the rest of the system.
Add the usual gem line to your project's Gemfile.
gem 'ansi'
And run then bundle command.
To install with RubyGems simply open a console and type:
$ sudo gem install ansi
Please see HISTORY.md file.
Copyright (c) 2009 Rubyworks
This program is redistributable under the terms of the BSD-2-Clause license.
Some pieces of the code are copyrighted by others.
See LICENSE.txt and NOTICE.md files for details.
Overall
Maintained
Code review
RubyGems
Latest release
Releases this year
194 followers · starred Sep 2009
827 followers · starred Sep 2009
245 followers · starred Sep 2009
Set of ANSI Code based classes and modules for Ruby
See the codeThe ANSI project is a collection of ANSI escape code related libraries enabling ANSI code based colorization and stylization of output. It is very nice for beautifying shell output.
This collection is based on a set of scripts spun-off from Ruby Facets. Included are Code (used to be ANSICode), Logger, ProgressBar and String. In addition the library includes Terminal which provides information about the current output device.
There are a number of modules and classes provided by the ANSI package. To get a good understanding of them it is best to pursue the QED documents or the API documentation.
At the heart of all the provided libraries lies the ANSI::Code module which defines ANSI codes as constants and methods. For example:
require 'ansi/code'
ANSI.red + "Hello" + ANSI.blue + "World"
=> "\e[31mHello\e[34mWorld"
Or in block form.
ANSI.red{ "Hello" } + ANSI.blue{ "World" }
=> "\e[31mHello\e[0m\e[34mWorld\e[0m"
The methods defined by this module are used throughout the rest of the system.
Add the usual gem line to your project's Gemfile.
gem 'ansi'
And run then bundle command.
To install with RubyGems simply open a console and type:
$ sudo gem install ansi
Please see HISTORY.md file.
Copyright (c) 2009 Rubyworks
This program is redistributable under the terms of the BSD-2-Clause license.
Some pieces of the code are copyrighted by others.
See LICENSE.txt and NOTICE.md files for details.
Overall
Maintained
Code review
RubyGems
Latest release
Releases this year
194 followers · starred Sep 2009
827 followers · starred Sep 2009
245 followers · starred Sep 2009