I'm trying to write a program with colorized output. I looked at a few, and the gem I found was colorize. I've done some research, but I can't find step-by-step instructions on how to install a gem, require it, and use it. The gem I want is colorize, and I also need to know if there's anything else it requires. All I have is the standard ruby console that comes in the Ruby21 file, and notepad++ to write and save it. I need to know how and where to install it, whether I type something into the terminal or download a file and put it somewhere, and how to require it and its prerequisites(if any) in a file.
You can install the gem using your CLI simply by typing: gem install colorize
. You can then utilize the gem by requiring it, so at the top of your .rb file add require 'colorize'
. Then just test it out by trying puts "This is blue".colorize(:blue)
.
Your .rb
could look like this for example:
require 'colorize'
puts "This is blue".colorize(:blue)