Class: ChromeDiff::CompareStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/chrome_diff/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#diffObject (readonly)

Returns the value of attribute diff.



10
11
12
# File 'lib/chrome_diff/session.rb', line 10

def diff
  @diff
end

#diff_percentObject (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

#statusObject (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

Returns:

  • (Boolean)


20
21
22
# File 'lib/chrome_diff/session.rb', line 20

def success?
  @diff_percent <= @threshold
end