Class: SuperDiff::RSpec::MatcherTextTemplate::ColorizedText

Inherits:
Text
  • Object
show all
Defined in:
lib/super_diff/rspec/matcher_text_template.rb

Instance Method Summary collapse

Methods inherited from Text

#to_string_in_multiline_mode, #to_string_in_singleline_mode

Methods inherited from Base

#to_string_in_multiline_mode, #to_string_in_singleline_mode

Constructor Details

#initialize(color, *args, &block) ⇒ ColorizedText

Returns a new instance of ColorizedText.



144
145
146
147
148
# File 'lib/super_diff/rspec/matcher_text_template.rb', line 144

def initialize(color, *args, &block)
  super(*args, &block)

  @color = color
end

Instance Method Details

#lengthObject



154
155
156
# File 'lib/super_diff/rspec/matcher_text_template.rb', line 154

def length
  evaluate.to_s.length
end

#to_sObject



150
151
152
# File 'lib/super_diff/rspec/matcher_text_template.rb', line 150

def to_s
  colorizer.wrap(evaluate.to_s, color)
end