Class: ChromeDiff::CompareStatus
- Inherits:
-
Object
- Object
- ChromeDiff::CompareStatus
- Defined in:
- lib/chrome_diff/session.rb
Instance Attribute Summary collapse
-
#diff ⇒ Object
readonly
Returns the value of attribute diff.
-
#diff_percent ⇒ Object
readonly
Returns the value of attribute diff_percent.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, stderr, width, height, threshold) ⇒ CompareStatus
constructor
A new instance of CompareStatus.
- #success? ⇒ Boolean
Constructor Details
#initialize(status, stderr, width, height, threshold) ⇒ CompareStatus
Returns a new instance of CompareStatus.
12 13 14 15 16 17 18 |
# File 'lib/chrome_diff/session.rb', line 12 def initialize(status, stderr, width, height, threshold) @status = status @threshold = threshold @diff = stderr.to_f.to_i @diff_percent = @diff.to_f / width / height * 100 end |
Instance Attribute Details
#diff ⇒ Object (readonly)
Returns the value of attribute diff.
10 11 12 |
# File 'lib/chrome_diff/session.rb', line 10 def diff @diff end |
#diff_percent ⇒ Object (readonly)
Returns the value of attribute diff_percent.
10 11 12 |
# File 'lib/chrome_diff/session.rb', line 10 def diff_percent @diff_percent end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/chrome_diff/session.rb', line 10 def status @status end |
Instance Method Details
#success? ⇒ Boolean
20 21 22 |
# File 'lib/chrome_diff/session.rb', line 20 def success? @diff_percent <= @threshold end |