Module: Capybara::Screenshot::Diff::Utils
- Defined in:
- lib/capybara/screenshot/diff/utils.rb
Class Method Summary collapse
Class Method Details
.detect_available_drivers ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/capybara/screenshot/diff/utils.rb', line 7 def self.detect_available_drivers result = [] begin result << :vips if defined?(Vips) || require("vips") rescue LoadError # vips not present Object.send(:remove_const, :Vips) if defined?(Vips) end begin result << :chunky_png if defined?(ChunkyPNG) || require("chunky_png") rescue LoadError # chunky_png not present Object.send(:remove_const, :ChunkyPNG) if defined?(ChunkyPNG) end result end |
.find_driver_class_for(driver) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/capybara/screenshot/diff/utils.rb', line 24 def self.find_driver_class_for(driver) driver = AVAILABLE_DRIVERS.first if driver == :auto LOADED_DRIVERS[driver] ||= case driver when :chunky_png require "capybara/screenshot/diff/drivers/chunky_png_driver" Drivers::ChunkyPNGDriver when :vips require "capybara/screenshot/diff/drivers/vips_driver" Drivers::VipsDriver else fail "Wrong adapter #{driver.inspect}. Available adapters: #{AVAILABLE_DRIVERS.inspect}" end end |