Class: RSpec::CapturingFormatter::Renderer::FailureColorizer
- Inherits:
-
Object
- Object
- RSpec::CapturingFormatter::Renderer::FailureColorizer
- Defined in:
- lib/rspec/capturing_formatter/renderer.rb
Overview
Adapts the formatter's color policy to RSpec's failure-presenter interface.
Instance Method Summary collapse
-
#initialize(renderer) ⇒ FailureColorizer
constructor
A new instance of FailureColorizer.
- #wrap(text, color) ⇒ Object
Constructor Details
#initialize(renderer) ⇒ FailureColorizer
Returns a new instance of FailureColorizer.
430 431 432 |
# File 'lib/rspec/capturing_formatter/renderer.rb', line 430 def initialize(renderer) @renderer = renderer end |
Instance Method Details
#wrap(text, color) ⇒ Object
434 435 436 437 438 439 |
# File 'lib/rspec/capturing_formatter/renderer.rb', line 434 def wrap(text, color) return text unless @renderer.formatter_color_enabled? code = COLORS[color] code ? "#{code}#{text}#{RESET}" : text end |