Class: Pincers::Factories::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pincers/factories/base.rb

Direct Known Subclasses

Nokogiri, Webdriver

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_options) ⇒ Base

Returns a new instance of Base.



11
12
13
14
# File 'lib/pincers/factories/base.rb', line 11

def initialize(_options)
  @context_options = extract_context_options _options
  @backend_options = _options
end

Class Method Details

.new_context(_options) ⇒ Object



7
8
9
# File 'lib/pincers/factories/base.rb', line 7

def self.new_context(_options)
  self.new(_options).new_context
end

Instance Method Details

#load_backend(_options) ⇒ Object

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/pincers/factories/base.rb', line 21

def load_backend(_options)
  raise NotImplementedError
end

#new_contextObject



16
17
18
19
# File 'lib/pincers/factories/base.rb', line 16

def new_context
  backend = load_backend @backend_options
  ::Pincers::Core::RootContext.new backend, @context_options
end