class SyntaxTree::CLI::Color

A utility wrapper around colored strings in the output.

Attributes

code[R]
value[R]

Public Class Methods

bold(value) click to toggle source
# File lib/syntax_tree/cli.rb, line 23
def self.bold(value)
  new(value, "1")
end
gray(value) click to toggle source
# File lib/syntax_tree/cli.rb, line 27
def self.gray(value)
  new(value, "38;5;102")
end
new(value, code) click to toggle source
# File lib/syntax_tree/cli.rb, line 14
def initialize(value, code)
  @value = value
  @code = code
end
red(value) click to toggle source
# File lib/syntax_tree/cli.rb, line 31
def self.red(value)
  new(value, "1;31")
end
yellow(value) click to toggle source
# File lib/syntax_tree/cli.rb, line 35
def self.yellow(value)
  new(value, "33")
end

Public Instance Methods

to_s() click to toggle source
# File lib/syntax_tree/cli.rb, line 19
def to_s
  "\033[#{code}m#{value}\033[0m"
end