module Pincers::Factory

Public Instance Methods

for_chenso(_options={}) click to toggle source
# File lib/pincers/factory.rb, line 33
def for_chenso(_options={})
  require 'pincers/chenso/factory'
  Chenso::Factory.new_context _options
end
for_nokogiri(_document, _options={}) click to toggle source
# File lib/pincers/factory.rb, line 25
def for_nokogiri(_document, _options={})
  require 'pincers/nokogiri/factory'

  _options[:document] = _document

  Nokogiri::Factory.new_context _options
end
for_webdriver(_driver=nil, _options={}) { |context| ... } click to toggle source
# File lib/pincers/factory.rb, line 4
def for_webdriver(_driver=nil, _options={}, &_block)
  require 'pincers/webdriver/factory'

  if _driver.is_a? Hash
    _options = _driver
    _driver = nil
  end

  _options[:driver] = _driver || config.webdriver_bridge

  context = Webdriver::Factory.new_context _options

  if _block
    begin
      yield context
    ensure
      context.close
    end
  else context end
end