Sha256: 1bc7b216436acc177d68c7f9187f84da815137a14f4291eab315201e82b0a84c

Contents?: true

Size: 891 Bytes

Versions: 38

Compression:

Stored size: 891 Bytes

Contents

require 'rom/configuration_dsl/command'

module ROM
  module ConfigurationDSL
    # Command `define` DSL used by Setup#commands
    #
    # @private
    class CommandDSL
      attr_reader :relation, :adapter, :command_classes

      # @api private
      def initialize(relation, adapter = nil, &block)
        @relation = relation
        @adapter = adapter
        @command_classes = []
        instance_exec(&block)
      end

      # Define a command class
      #
      # @param [Symbol] name of the command
      # @param [Hash] options
      # @option options [Symbol] :type The type of the command
      #
      # @return [Class] generated class
      #
      # @api public
      def define(name, options = EMPTY_HASH, &block)
        @command_classes << Command.build_class(
          name, relation, { adapter: adapter }.merge(options), &block
        )
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
rom-core-4.2.1 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.2.0 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.1.2 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.1.1 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.1.0 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.2 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.1 lib/rom/configuration_dsl/command_dsl.rb
rom-3.3.3 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.0 lib/rom/configuration_dsl/command_dsl.rb
rom-3.3.2 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.0.rc2 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.0.rc1 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.0.beta3 lib/rom/configuration_dsl/command_dsl.rb
rom-3.3.1 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.0.beta2 lib/rom/configuration_dsl/command_dsl.rb
rom-3.3.0 lib/rom/configuration_dsl/command_dsl.rb
rom-core-4.0.0.beta1 lib/rom/configuration_dsl/command_dsl.rb
rom-3.2.3 lib/rom/configuration_dsl/command_dsl.rb
rom-3.2.2 lib/rom/configuration_dsl/command_dsl.rb
rom-3.2.1 lib/rom/configuration_dsl/command_dsl.rb