class Pincers::Core::BaseFactory

Public Class Methods

new(_options) click to toggle source
# File lib/pincers/core/base_factory.rb, line 9
def initialize(_options)
  @context_options = extract_context_options _options
  @backend_options = _options
end
new_context(_options) click to toggle source
# File lib/pincers/core/base_factory.rb, line 5
def self.new_context(_options)
  self.new(_options).new_context
end

Public Instance Methods

load_backend(_options) click to toggle source
# File lib/pincers/core/base_factory.rb, line 19
def load_backend(_options)
  raise NotImplementedError
end
new_context() click to toggle source
# File lib/pincers/core/base_factory.rb, line 14
def new_context
  backend = load_backend @backend_options
  ::Pincers::Core::RootContext.new backend, @context_options
end

Private Instance Methods

extract_context_options(_options) click to toggle source
# File lib/pincers/core/base_factory.rb, line 25
def extract_context_options(_options)
  [:wait_interval, :wait_timeout, :advanced_mode].inject({}) do |opt, key|
    opt[key] = _options.delete key if _options.key? key
    opt
  end
end