Class: DotDiff::CommandWrapper
- Inherits:
-
Object
- Object
- DotDiff::CommandWrapper
- Defined in:
- lib/dotdiff/command_wrapper.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #failed? ⇒ Boolean
- #passed? ⇒ Boolean
- #ran_checks ⇒ Object
- #run(base_image, new_image, diff_image_path) ⇒ Object
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/dotdiff/command_wrapper.rb', line 5 def end |
Instance Method Details
#failed? ⇒ Boolean
31 32 33 |
# File 'lib/dotdiff/command_wrapper.rb', line 31 def failed? @ran_checks && @failed end |
#passed? ⇒ Boolean
27 28 29 |
# File 'lib/dotdiff/command_wrapper.rb', line 27 def passed? !failed? end |
#ran_checks ⇒ Object
35 36 37 |
# File 'lib/dotdiff/command_wrapper.rb', line 35 def ran_checks @ran_checks end |
#run(base_image, new_image, diff_image_path) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dotdiff/command_wrapper.rb', line 7 def run(base_image, new_image, diff_image_path) output = run_command(base_image, new_image, diff_image_path) @ran_checks = true begin pixels = Float(output) if pixels && pixels <= DotDiff.pixel_threshold @failed = false else @failed = true = "Images are #{pixels} pixels different" end rescue ArgumentError => e @failed = true = output end end |