class ROM::ConfigurationDSL::MapperDSL

Mapper definition DSL used by Setup DSL

@private

Attributes

configuration[R]
defined_mappers[R]
mapper_classes[R]

Public Class Methods

new(configuration, mapper_classes, block) click to toggle source

@api private

# File lib/rom/configuration_dsl/mapper_dsl.rb, line 14
def initialize(configuration, mapper_classes, block)
  @configuration = configuration
  @mapper_classes = mapper_classes
  @defined_mappers = []

  instance_exec(&block)

  @mapper_classes = @defined_mappers
end

Public Instance Methods

define(name, options = EMPTY_HASH, &block) click to toggle source

Define a mapper class

@param [Symbol] name of the mapper @param [Hash] options

@return [Class]

@api public

# File lib/rom/configuration_dsl/mapper_dsl.rb, line 32
def define(name, options = EMPTY_HASH, &block)
  @defined_mappers << Mapper::Builder.build_class(name, (@mapper_classes + @defined_mappers), options, &block)
  self
end
register(relation, mappers) click to toggle source

TODO

@api public

# File lib/rom/configuration_dsl/mapper_dsl.rb, line 40
def register(relation, mappers)
  configuration.register_mapper(relation => mappers)
end