Sha256: 70e2d6dccd1c613dc3425fad1b8c2dda7f336d8b901b91e868caf3ac85861eda

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

require 'rom/setup_dsl/mapper'

module ROM
  class Setup
    # Mapper definition DSL used by Setup DSL
    #
    # @private
    class MapperDSL
      attr_reader :registry

      # @api private
      def initialize(registry, &block)
        @registry = registry
        instance_exec(&block)
      end

      # Define a mapper class
      #
      # @param [Symbol] name of the mapper
      # @param [Hash] options
      #
      # @return [Class]
      #
      # @api public
      def define(name, options = EMPTY_HASH, &block)
        Mapper.build_class(name, options, &block)
        self
      end

      # TODO
      #
      # @api public
      def register(relation, mappers)
        registry.register_mapper(relation => mappers)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-0.9.1 lib/rom/setup_dsl/mapper_dsl.rb
rom-0.9.0 lib/rom/setup_dsl/mapper_dsl.rb