Class: RailsDomainModel::Command
- Inherits:
-
Object
- Object
- RailsDomainModel::Command
- Defined in:
- lib/rails_domain_model/command.rb
Direct Known Subclasses
Defined Under Namespace
Classes: ValidationError
Class Attribute Summary collapse
-
.aggregate_class ⇒ Object
Returns the value of attribute aggregate_class.
-
.aggregate_id_attribute ⇒ Object
Returns the value of attribute aggregate_id_attribute.
-
.aggregate_method ⇒ Object
Returns the value of attribute aggregate_method.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.aggregate_class ⇒ Object
Returns the value of attribute aggregate_class.
10 11 12 |
# File 'lib/rails_domain_model/command.rb', line 10 def aggregate_class @aggregate_class end |
.aggregate_id_attribute ⇒ Object
Returns the value of attribute aggregate_id_attribute.
10 11 12 |
# File 'lib/rails_domain_model/command.rb', line 10 def aggregate_id_attribute @aggregate_id_attribute end |
.aggregate_method ⇒ Object
Returns the value of attribute aggregate_method.
10 11 12 |
# File 'lib/rails_domain_model/command.rb', line 10 def aggregate_method @aggregate_method end |
Class Method Details
.with_aggregate(klass, id_attribute, method) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rails_domain_model/command.rb', line 13 def self.with_aggregate(klass, id_attribute, method) @aggregate_class = klass @aggregate_id_attribute = id_attribute @aggregate_method = method validates @aggregate_id_attribute, presence: true end |
Instance Method Details
#execute! ⇒ Object
21 22 23 24 25 |
# File 'lib/rails_domain_model/command.rb', line 21 def execute! validate! RailsDomainModel::CommandHandler.new(self).handle! end |