Object
# File lib/test/unit/color.rb, line 8 def initialize(name, options={}) @name = name @foreground = options[:foreground] @foreground = true if @foreground.nil? @intensity = options[:intensity] @bold = options[:bold] @italic = options[:italic] @underline = options[:underline] end
# File lib/test/unit/color.rb, line 66 def +(other) MixColor.new([self, other]) end
# File lib/test/unit/color.rb, line 38 def ==(other) self.class === other and [name, foreground?, intensity?, bold?, italic?, underline?] == [other.name, other.foreground?, other.intensity?, other.bold?, other.italic?, other.underline?] end
# File lib/test/unit/color.rb, line 62 def escape_sequence "\e[#{sequence.join(';')}m" end
# File lib/test/unit/color.rb, line 18 def foreground? @foreground end
# File lib/test/unit/color.rb, line 22 def intensity? @intensity end
# File lib/test/unit/color.rb, line 46 def sequence sequence = [] if @name == "none" elsif @name == "reset" sequence << "0" else foreground_parameter = foreground? ? 3 : 4 foreground_parameter += 6 if intensity? sequence << "#{foreground_parameter}#{NAMES.index(@name)}" end sequence << "1" if bold? sequence << "3" if italic? sequence << "4" if underline? sequence end
Generated with the Darkfish Rdoc Generator 2.