class Omnidata::Adapters::AdapterManager

Attributes

adapters[R]

Public Class Methods

new() click to toggle source
# File lib/omnidata/adapters/adapter_manager.rb, line 14
def initialize
  reset
end

Public Instance Methods

adapter(name) click to toggle source
# File lib/omnidata/adapters/adapter_manager.rb, line 38
def adapter(name)
  @adapters[name]
end
add(name, options) click to toggle source
# File lib/omnidata/adapters/adapter_manager.rb, line 22
def add(name, options)
  if adapter(name)
    raise AdapterError.new("adapter #{name} exists")
  end

  adapter = build_adapter(options)
  adapter.name = name
  @adapters[name] = adapter
end
build_adapter(options) click to toggle source
# File lib/omnidata/adapters/adapter_manager.rb, line 32
def build_adapter(options)
  opts = options.dup
  name = opts.delete(:adapter).capitalize
  "Omnidata::Adapters::#{name}Adapter".constantize.new(opts)
end
reset() click to toggle source
# File lib/omnidata/adapters/adapter_manager.rb, line 18
def reset
  @adapters = {}
end