Sha256: cfa121ae17a3cec33ecaaa34b3ffdea69b50f50f3841a885faa493432eecb56d

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

require 'rom/setup/base_relation_dsl'

module ROM
  class Setup
    # @private
    class SchemaDSL
      attr_reader :env, :schema

      # @api private
      def initialize(env, schema, &block)
        @env = env
        @schema = schema
        initialize_schema
        instance_exec(&block)
      end

      # @api public
      def base_relation(name, &block)
        dsl = BaseRelationDSL.new(env, name, &block)
        schema[dsl.repository] << dsl.call
      end

      private

      # @api private
      def initialize_schema
        env.repositories.each_value do |repository|
          schema[repository] ||= []
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-0.5.0 lib/rom/setup/schema_dsl.rb