Class: Lyra::Command
- Inherits:
-
Object
- Object
- Lyra::Command
- Defined in:
- lib/lyra/command.rb
Overview
Base command class
Direct Known Subclasses
Lyra::Commands::CreateCommand, Lyra::Commands::DestroyCommand, Lyra::Commands::UpdateCommand
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
Instance Method Summary collapse
- #aggregate_id ⇒ Object
-
#initialize(model_class, data = {}) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(model_class, data = {}) ⇒ Command
Returns a new instance of Command.
6 7 8 9 |
# File 'lib/lyra/command.rb', line 6 def initialize(model_class, data = {}) @model_class = model_class @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/lyra/command.rb', line 4 def data @data end |
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
4 5 6 |
# File 'lib/lyra/command.rb', line 4 def model_class @model_class end |
Instance Method Details
#aggregate_id ⇒ Object
11 12 13 |
# File 'lib/lyra/command.rb', line 11 def aggregate_id data[:id] || data['id'] end |