Class: GroongaQueryLog::Command::Analyzer::ConsoleReporter::MixColor

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/command/analyzer/reporter/console.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(colors) ⇒ MixColor

Returns a new instance of MixColor.



102
103
104
# File 'lib/groonga-query-log/command/analyzer/reporter/console.rb', line 102

def initialize(colors)
  @colors = colors
end

Instance Attribute Details

#colorsObject (readonly)

Returns the value of attribute colors.



101
102
103
# File 'lib/groonga-query-log/command/analyzer/reporter/console.rb', line 101

def colors
  @colors
end

Instance Method Details

#+(other) ⇒ Object



116
117
118
# File 'lib/groonga-query-log/command/analyzer/reporter/console.rb', line 116

def +(other)
  self.class.new([self, other])
end

#==(other) ⇒ Object



120
121
122
# File 'lib/groonga-query-log/command/analyzer/reporter/console.rb', line 120

def ==(other)
  self.class === other and colors == other.colors
end

#escape_sequenceObject



112
113
114
# File 'lib/groonga-query-log/command/analyzer/reporter/console.rb', line 112

def escape_sequence
  "\e[#{sequence.join(';')}m"
end

#sequenceObject



106
107
108
109
110
# File 'lib/groonga-query-log/command/analyzer/reporter/console.rb', line 106

def sequence
  @colors.inject([]) do |result, color|
    result + color.sequence
  end
end