class String

colored strings

Public Instance Methods

green() click to toggle source
# File lib/one_helper/onevm_helper.rb, line 40
def green
    colorize(32)
end
red() click to toggle source
# File lib/one_helper/onevm_helper.rb, line 36
def red
    colorize(31)
end
unindent(spaces=nil) click to toggle source
# File lib/command_parser.rb, line 21
def unindent(spaces=nil)
    unless spaces
        m = self.match(/^(\s*)/)
        spaces = m[1].size
    end

    self.gsub!(/^ {#{spaces}}/, '')
end

Private Instance Methods

colorize(color_code) click to toggle source
# File lib/one_helper/onevm_helper.rb, line 46
def colorize(color_code)
    "\e[#{color_code}m#{self}\e[0m"
end