Sha256: 8ece0da1e45f8f7bb8f8f239ccb2e1ba1553e01171540b73dbf98625c4d9e3e1

Contents?: true

Size: 754 Bytes

Versions: 6

Compression:

Stored size: 754 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 = {}, &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

6 entries across 6 versions & 1 rubygems

Version Path
rom-0.9.0.rc1 lib/rom/setup_dsl/mapper_dsl.rb
rom-0.9.0.beta1 lib/rom/setup_dsl/mapper_dsl.rb
rom-0.8.1 lib/rom/setup_dsl/mapper_dsl.rb
rom-0.8.0 lib/rom/setup_dsl/mapper_dsl.rb
rom-0.7.1 lib/rom/setup_dsl/mapper_dsl.rb
rom-0.7.0 lib/rom/setup_dsl/mapper_dsl.rb