Class: Test::Unit::MixColor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(colors) ⇒ MixColor

Returns a new instance of MixColor.



113
114
115
# File 'lib/test/unit/color.rb', line 113

def initialize(colors)
  @colors = colors
end

Instance Attribute Details

#colors ⇒ Object (readonly)

Returns the value of attribute colors.



112
113
114
# File 'lib/test/unit/color.rb', line 112

def colors
  @colors
end

Instance Method Details

#+(other) ⇒ Object



127
128
129
# File 'lib/test/unit/color.rb', line 127

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

#==(other) ⇒ Object



131
132
133
# File 'lib/test/unit/color.rb', line 131

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

#escape_sequence ⇒ Object



123
124
125
# File 'lib/test/unit/color.rb', line 123

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

#sequence ⇒ Object



117
118
119
120
121
# File 'lib/test/unit/color.rb', line 117

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