class ROM::ConfigurationDSL::CommandDSL

Command `define` DSL used by Setup#commands

@private

Attributes

adapter[R]
command_classes[R]
relation[R]

Public Class Methods

new(relation, adapter = nil, &block) click to toggle source

@api private

# File lib/rom/configuration_dsl/command_dsl.rb, line 14
def initialize(relation, adapter = nil, &block)
  @relation = relation
  @adapter = adapter
  @command_classes = []
  instance_exec(&block)
end

Public Instance Methods

define(name, options = EMPTY_HASH, &block) click to toggle source

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

# File lib/rom/configuration_dsl/command_dsl.rb, line 30
def define(name, options = EMPTY_HASH, &block)
  @command_classes << Command.build_class(
    name, relation, { adapter: adapter }.merge(options), &block
  )
end