class Juvet::Mapper
Attributes
collections[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/juvet/mapper.rb, line 7 def initialize(&block) @collections = {} instance_eval(&block) if block_given? end
Public Instance Methods
build(adapter)
click to toggle source
# File lib/juvet/mapper.rb, line 17 def build(adapter) collections.each_pair do |name, collection| if collection.repository && collection.repository.adapter == adapter.type adapter_instance = adapter.build.new collection, adapter.options collection.repository.klass.adapter = adapter_instance end end end
collection(name, &block)
click to toggle source
# File lib/juvet/mapper.rb, line 13 def collection(name, &block) collections[name] = Juvet::Mapper::Collection.new name, &block end