Module: WatchDoge::Regression::Utils
- Defined in:
- lib/watchdoge/regression/utils.rb
Class Method Summary collapse
- .load_png(input) ⇒ Object
- .path_to_filename(path) ⇒ Object
- .reference_dir ⇒ Object
- .regression_dir ⇒ Object
- .scenarios_dir ⇒ Object
Class Method Details
.load_png(input) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/watchdoge/regression/utils.rb', line 9 def load_png input raise 'Invalid Input' unless input.respond_to? :length png_magic = ["89", "50", "4E", "47"] is_png_blob = (input.length > 3 && input[0..3].each_byte.map {|t| t.to_s(16).upcase} == png_magic) if is_png_blob ChunkyPNG::Image.from_blob input else ChunkyPNG::Image.from_file input end end |
.path_to_filename(path) ⇒ Object
24 25 26 |
# File 'lib/watchdoge/regression/utils.rb', line 24 def path_to_filename path path.gsub(/\//, '_') end |
.reference_dir ⇒ Object
36 37 38 |
# File 'lib/watchdoge/regression/utils.rb', line 36 def reference_dir "#{regression_dir}/reference" end |
.regression_dir ⇒ Object
28 29 30 |
# File 'lib/watchdoge/regression/utils.rb', line 28 def regression_dir WatchDoge.configuration.regression_dir end |
.scenarios_dir ⇒ Object
32 33 34 |
# File 'lib/watchdoge/regression/utils.rb', line 32 def scenarios_dir "#{regression_dir}/scenarios" end |