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.



73
74
75
# File 'lib/test/unit/color.rb', line 73

def initialize(colors)
  @colors = colors
end

Instance Attribute Details

#colorsObject (readonly)

Returns the value of attribute colors.



72
73
74
# File 'lib/test/unit/color.rb', line 72

def colors
  @colors
end

Instance Method Details

#+(other) ⇒ Object



87
88
89
# File 'lib/test/unit/color.rb', line 87

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

#==(other) ⇒ Object



91
92
93
# File 'lib/test/unit/color.rb', line 91

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

#escape_sequenceObject



83
84
85
# File 'lib/test/unit/color.rb', line 83

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

#sequenceObject



77
78
79
80
81
# File 'lib/test/unit/color.rb', line 77

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