Class: ROM::ConfigurationDSL::CommandDSL
- Inherits:
-
Object
- Object
- ROM::ConfigurationDSL::CommandDSL
- Defined in:
- lib/rom/configuration_dsl/command_dsl.rb
Overview
Command ‘define` DSL used by Setup#commands
Instance Attribute Summary collapse
- #adapter ⇒ Object readonly
- #command_classes ⇒ Object readonly
- #relation ⇒ Object readonly
Instance Method Summary collapse
-
#define(name, options = EMPTY_HASH) ⇒ Class
Define a command class.
-
#initialize(relation, adapter = nil) ⇒ CommandDSL
constructor
private
A new instance of CommandDSL.
Constructor Details
#initialize(relation, adapter = nil) ⇒ CommandDSL
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CommandDSL.
18 19 20 21 22 23 |
# File 'lib/rom/configuration_dsl/command_dsl.rb', line 18 def initialize(relation, adapter = nil, &) @relation = relation @adapter = adapter @command_classes = [] instance_exec(&) end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
13 14 15 |
# File 'lib/rom/configuration_dsl/command_dsl.rb', line 13 def adapter @adapter end |
#command_classes ⇒ Object (readonly)
15 16 17 |
# File 'lib/rom/configuration_dsl/command_dsl.rb', line 15 def command_classes @command_classes end |
#relation ⇒ Object (readonly)
11 12 13 |
# File 'lib/rom/configuration_dsl/command_dsl.rb', line 11 def relation @relation end |
Instance Method Details
#define(name, options = EMPTY_HASH) ⇒ Class
Define a command class
34 35 36 37 38 |
# File 'lib/rom/configuration_dsl/command_dsl.rb', line 34 def define(name, = EMPTY_HASH, &) @command_classes << Command.build_class( name, relation, { adapter: adapter }.merge(), & ) end |