Class: ImageDiff::Differ::Results::Output
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- ImageDiff::Differ::Results::Output
- Defined in:
- lib/image_diff/differ/results/output.rb
Overview
Decorator for Results hash
Constant Summary collapse
- CURRENT_DIR =
File.dirname(__FILE__)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Output
constructor
A new instance of Output.
- #out ⇒ Object
- #render_reference_errors ⇒ Object
- #render_regression_errors ⇒ Object
Constructor Details
Class Method Details
.clear ⇒ Object
48 49 50 |
# File 'lib/image_diff/differ/results/output.rb', line 48 def self.clear List.instance.clear end |
.flush ⇒ Object
52 53 54 55 56 |
# File 'lib/image_diff/differ/results/output.rb', line 52 def self.flush return if List.instance.empty? new.out end |
Instance Method Details
#out ⇒ Object
17 18 19 20 |
# File 'lib/image_diff/differ/results/output.rb', line 17 def out render_reference_errors render_regression_errors end |
#render_reference_errors ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/image_diff/differ/results/output.rb', line 22 def render_reference_errors print_str = String.new '' unless @reference_errors.empty? @reference_errors.map do |component, failures| print_str << "The following reference files were not found, you need to generate screenshots before comparing...\n" failures.each do |failure| print_str << "\033[31m#{failure.snapshot.filename}\033[0m\n" end end end print print_str end |
#render_regression_errors ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/image_diff/differ/results/output.rb', line 35 def render_regression_errors print_str = String.new '' unless @regressions.empty? @regressions.map do |component, failures| print_str << "The following screenshots are different from the comparison image, if this expected then regenerate comparison images...\n" failures.each do |failure| print_str << "\033[31m#{failure.output}\033[0m\n" end end end print print_str end |