module Datamappify::Repository::MappingDSL
Public Instance Methods
default_provider(provider_name)
click to toggle source
@param provider_name [String]
name of data provider
@return [void]
# File lib/datamappify/repository/mapping_dsl.rb, line 22 def default_provider(provider_name) data_mapper.default_provider_name = provider_name.to_s end
for_entity(entity_class)
click to toggle source
If the entity is lazy loaded then it assigns the repository itself back to the entity
@param entity_class [Class]
@return [void]
# File lib/datamappify/repository/mapping_dsl.rb, line 12 def for_entity(entity_class) data_mapper.entity_class = entity_class assign_to_entity if lazy_load? end
group(options = {}, &block)
click to toggle source
@param options [Hash]
@yield
a block containing `map_attribute` DSLs
@return [void]
# File lib/datamappify/repository/mapping_dsl.rb, line 39 def group(options = {}, &block) self.current_group_options = options block.call self.current_group_options = {} end
map_attribute(name, options = {})
click to toggle source
@param (see Data::Mapper::Attribute#initialize)
@return [void]
# File lib/datamappify/repository/mapping_dsl.rb, line 29 def map_attribute(name, options = {}) data_mapper.custom_mapping[name.to_sym] = self.current_group_options.merge(options) end