Sha256: 3d4fa2fdfa83c3adc23be64d9b3812d7d40943902e0d00e4197fa1765505ec6c

Contents?: true

Size: 795 Bytes

Versions: 13

Compression:

Stored size: 795 Bytes

Contents

require 'rom/setup_dsl/command'

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

      # @api private
      def initialize(relation, adapter = nil, &block)
        @relation = relation
        @adapter = adapter
        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 = {}, &block)
        Command.build_class(
          name, relation, { adapter: adapter }.merge(options), &block
        )
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rom-0.9.0.rc1 lib/rom/setup_dsl/command_dsl.rb
rom-0.9.0.beta1 lib/rom/setup_dsl/command_dsl.rb
rom-0.8.1 lib/rom/setup_dsl/command_dsl.rb
rom-0.8.0 lib/rom/setup_dsl/command_dsl.rb
rom-0.7.1 lib/rom/setup_dsl/command_dsl.rb
rom-0.7.0 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.2 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.1 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.0 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.0.rc1 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.0.beta3 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.0.beta2 lib/rom/setup_dsl/command_dsl.rb
rom-0.6.0.beta1 lib/rom/setup_dsl/command_dsl.rb