Module: GitCompound::Logger::Colors

Included in:
String
Defined in:
lib/git_compound/logger/colors.rb

Overview

Colors module

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(parent_class) ⇒ Object



6
7
8
9
# File 'lib/git_compound/logger/colors.rb', line 6

def self.included(parent_class)
  parent_class.extend ClassMethods
  parent_class.class_eval { create_color_methods }
end

Instance Method Details

#colorize(params) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/git_compound/logger/colors.rb', line 11

def colorize(params)
  return self if colors_unavailable?
  scan_colors.inject('') do |str, match|
    set_colors(match, params)
    str << "\033[#{match[0]};#{match[1]};#{match[2]}m#{match[3]}\033[0m"
  end
end