Class: Test::Unit::MixColor
- Inherits:
-
Object
- Object
- Test::Unit::MixColor
- Defined in:
- lib/test/unit/color.rb
Instance Attribute Summary collapse
-
#colors ⇒ Object
readonly
Returns the value of attribute colors.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #==(other) ⇒ Object
- #escape_sequence ⇒ Object
-
#initialize(colors) ⇒ MixColor
constructor
A new instance of MixColor.
- #sequence ⇒ Object
Constructor Details
#initialize(colors) ⇒ MixColor
Returns a new instance of MixColor.
111 112 113 |
# File 'lib/test/unit/color.rb', line 111 def initialize(colors) @colors = colors end |
Instance Attribute Details
#colors ⇒ Object (readonly)
Returns the value of attribute colors.
110 111 112 |
# File 'lib/test/unit/color.rb', line 110 def colors @colors end |
Instance Method Details
#+(other) ⇒ Object
125 126 127 |
# File 'lib/test/unit/color.rb', line 125 def +(other) self.class.new([self, other]) end |
#==(other) ⇒ Object
129 130 131 |
# File 'lib/test/unit/color.rb', line 129 def ==(other) self.class === other and colors == other.colors end |
#escape_sequence ⇒ Object
121 122 123 |
# File 'lib/test/unit/color.rb', line 121 def escape_sequence "\e[#{sequence.join(';')}m" end |
#sequence ⇒ Object
115 116 117 118 119 |
# File 'lib/test/unit/color.rb', line 115 def sequence @colors.inject([]) do |result, color| result + color.sequence end end |