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) ⇒ ColorizedText

Returns a new instance of ColorizedText.



139
140
141
142
143
# File 'lib/super_diff/rspec/matcher_text_template.rb', line 139

def initialize(color, ...)
  super(...)

  @color = color
end

Instance Method Details

#lengthObject



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

def length
  evaluate.to_s.length
end

#to_sObject



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

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