Sha256: 3bea43ed7de3e8ae16c2d906e3f030f84faf2f0d02c4cb77b2f3b65aa5595edf
Contents?: true
Size: 1.58 KB
Versions: 3
Compression:
Stored size: 1.58 KB
Contents
module PageMagic # class Driver - instances are factories for drivers used by PageMagic class Driver attr_reader :supported_browsers, :handler # Creates a driver definition # @example # Driver.new do |rack_application, options| # require 'capybara/driver_class' # Capybara::Driver::Class.new(app, options) # end # @yield[rack_application, options, browser_name] # @yieldparam [Object] rack_application rack compatible application # @yieldparam [Hash] options hash containing driver specific options # @yieldparam [Symbol] browser_name the name of the required browser name # @param [*Symbol] supported_browsers list of browsers names. These are the names that # you will refer to them by when creating a session # @yieldreturn [Object] Capybara compliant driver def initialize(*supported_browsers, &block) @handler = block @supported_browsers = supported_browsers end # Determines if the given browser name is supported by this driver definition # @param [Symbol] browser name of browser # @return [Boolean] true if definition supports the given driver name def support?(browser) supported_browsers.include?(browser) end # Build a new driver instance based on this definition # @param [Object] app - rack compatible application # @param [Symbol] browser name of required browser # @param [Hash] options driver specific options # @return [Object] Capybara compliant driver instance def build(app, browser:, options:{}) handler.call(app, options, browser) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
page_magic-1.0.0.alpha21 | lib/page_magic/driver.rb |
page_magic-1.0.0.alpha20 | lib/page_magic/driver.rb |
page_magic-1.0.0.alpha19 | lib/page_magic/driver.rb |