Class: Screenpress::Compare
- Inherits:
-
Object
- Object
- Screenpress::Compare
- Includes:
- ChunkyPNG::Color
- Defined in:
- lib/screenpress/compare.rb
Instance Attribute Summary collapse
-
#fresh_image ⇒ Object
readonly
Returns the value of attribute fresh_image.
-
#orig_image ⇒ Object
readonly
Returns the value of attribute orig_image.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
Instance Method Summary collapse
-
#initialize(orig_path, fresh_path, threshold) ⇒ Compare
constructor
A new instance of Compare.
- #same? ⇒ Boolean
Constructor Details
#initialize(orig_path, fresh_path, threshold) ⇒ Compare
Returns a new instance of Compare.
10 11 12 13 14 |
# File 'lib/screenpress/compare.rb', line 10 def initialize(orig_path, fresh_path, threshold) @orig_path = orig_path @fresh_path = fresh_path @threshold ||= threshold end |
Instance Attribute Details
#fresh_image ⇒ Object (readonly)
Returns the value of attribute fresh_image.
9 10 11 |
# File 'lib/screenpress/compare.rb', line 9 def fresh_image @fresh_image end |
#orig_image ⇒ Object (readonly)
Returns the value of attribute orig_image.
9 10 11 |
# File 'lib/screenpress/compare.rb', line 9 def orig_image @orig_image end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
9 10 11 |
# File 'lib/screenpress/compare.rb', line 9 def threshold @threshold end |
Instance Method Details
#same? ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/screenpress/compare.rb', line 16 def same? return !File.exists?(@fresh_path) if !File.exists?(@orig_path) setup return false unless diff_iterator if percentage_diff > 0 puts "Image Percentage Different #{@orig_path}: #{percentage_diff}" if percentage_diff > self.threshold puts " Image different!" return false end end true end |