Class: PageMagic::Driver
Overview
class Driver - instances are factories for drivers used by PageMagic
Instance Attribute Summary collapse
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#supported_browsers ⇒ Object
readonly
Returns the value of attribute supported_browsers.
Instance Method Summary collapse
-
#build(app, browser:, options: {}) ⇒ Object
Build a new driver instance based on this definition.
-
#initialize(*supported_browsers) {|rack_application, options, browser_name| ... } ⇒ Driver
constructor
Creates a driver definition @yield[rack_application, options, browser_name].
-
#support?(browser) ⇒ Boolean
Determines if the given browser name is supported by this driver definition.
Constructor Details
#initialize(*supported_browsers) {|rack_application, options, browser_name| ... } ⇒ Driver
Creates a driver definition @yield[rack_application, options, browser_name]
21 22 23 24 |
# File 'lib/page_magic/driver.rb', line 21 def initialize(*supported_browsers, &block) @handler = block @supported_browsers = supported_browsers end |
Instance Attribute Details
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
6 7 8 |
# File 'lib/page_magic/driver.rb', line 6 def handler @handler end |
#supported_browsers ⇒ Object (readonly)
Returns the value of attribute supported_browsers.
6 7 8 |
# File 'lib/page_magic/driver.rb', line 6 def supported_browsers @supported_browsers end |
Instance Method Details
#build(app, browser:, options: {}) ⇒ Object
Build a new driver instance based on this definition
31 32 33 |
# File 'lib/page_magic/driver.rb', line 31 def build(app, browser:, options: {}) handler.call(app, , browser) end |
#support?(browser) ⇒ Boolean
Determines if the given browser name is supported by this driver definition
38 39 40 |
# File 'lib/page_magic/driver.rb', line 38 def support?(browser) supported_browsers.include?(browser) end |