Class: Screenpress::Compare::Bits

Inherits:
Object
  • Object
show all
Includes:
ChunkyPNG::Color
Defined in:
lib/screenpress/compare/bits.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(orig_path, fresh_path) ⇒ Bits

Returns a new instance of Bits.



11
12
13
14
15
# File 'lib/screenpress/compare/bits.rb', line 11

def initialize(orig_path, fresh_path)
  @orig_image  = ChunkyPNG::Image.from_file(orig_path)
  @fresh_image = ChunkyPNG::Image.from_file(fresh_path)
  @diff_index  = []
end

Instance Attribute Details

#fresh_imageObject (readonly)

Returns the value of attribute fresh_image.



10
11
12
# File 'lib/screenpress/compare/bits.rb', line 10

def fresh_image
  @fresh_image
end

#orig_imageObject (readonly)

Returns the value of attribute orig_image.



10
11
12
# File 'lib/screenpress/compare/bits.rb', line 10

def orig_image
  @orig_image
end

Instance Method Details

#differenceObject



17
18
19
20
# File 'lib/screenpress/compare/bits.rb', line 17

def difference
  diff_iterator
  percentage_diff
end

#thresholdObject



22
23
24
# File 'lib/screenpress/compare/bits.rb', line 22

def threshold
  Screenpress.config.threshold || 0.1
end