Module: Pincers::Factory
- Included in:
- Pincers
- Defined in:
- lib/pincers/factory.rb
Instance Method Summary collapse
- #for_chenso(_options = {}) ⇒ Object
- #for_nokogiri(_document, _options = {}) ⇒ Object
- #for_webdriver(_driver = nil, _options = {}, &_block) ⇒ Object
Instance Method Details
#for_chenso(_options = {}) ⇒ Object
33 34 35 36 |
# File 'lib/pincers/factory.rb', line 33 def for_chenso(={}) require 'pincers/chenso/factory' Chenso::Factory.new_context end |
#for_nokogiri(_document, _options = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/pincers/factory.rb', line 25 def for_nokogiri(_document, ={}) require 'pincers/nokogiri/factory' [:document] = _document Nokogiri::Factory.new_context end |
#for_webdriver(_driver = nil, _options = {}, &_block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pincers/factory.rb', line 4 def for_webdriver(_driver=nil, ={}, &_block) require 'pincers/webdriver/factory' if _driver.is_a? Hash = _driver _driver = nil end [:driver] = _driver || config.webdriver_bridge context = Webdriver::Factory.new_context if _block begin yield context ensure context.close end else context end end |