Class: Test::MixColor

Inherits:
Object
  • Object
show all
Defined in:
lib/test-unit-ext/color.rb

Instance Method Summary collapse

Constructor Details

#initialize(colors) ⇒ MixColor

Returns a new instance of MixColor.



41
42
43
# File 'lib/test-unit-ext/color.rb', line 41

def initialize(colors)
  @colors = colors
end

Instance Method Details

#+(other) ⇒ Object



55
56
57
# File 'lib/test-unit-ext/color.rb', line 55

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

#escape_sequenceObject



51
52
53
# File 'lib/test-unit-ext/color.rb', line 51

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

#sequenceObject



45
46
47
48
49
# File 'lib/test-unit-ext/color.rb', line 45

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