Module: ReeMapper::DSL::ClassMethods
- Includes:
- Ree::Contracts::ArgContracts, Ree::Contracts::Core
- Defined in:
- lib/ree_lib/packages/ree_mapper/package/ree_mapper/dsl.rb
Instance Method Summary collapse
Instance Method Details
#build_mapper(register_as: nil) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/ree_lib/packages/ree_mapper/package/ree_mapper/dsl.rb', line 43 def build_mapper(register_as: nil) mapper_factory = ReeMapper.get_mapper_factory(Object.const_get(name.split('::').first)) mapper_factory.call(register_as: register_as) do |mapper| self.instance_variable_set(:@mapper, mapper) end end |
#mapper(name, &proc) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ree_lib/packages/ree_mapper/package/ree_mapper/dsl.rb', line 26 def mapper(name, &proc) dsl = Ree::ObjectDsl.new( Ree.container.packages_facade, name, self, :object ) dsl.instance_exec(&proc) if block_given? dsl.(["object", "mapper"]) dsl.factory :build Ree.container.compile(dsl.package, name) end |