Module: Euston::AggregateRootDslMethods::ClassMethods
- Defined in:
- lib/euston/aggregate_root_dsl_methods.rb
Instance Method Summary collapse
- #applies(event, version = 1, &block) ⇒ Object
-
#consumes(*arguments, &block) ⇒ Object
*args is an array of symbols plus an optional options hash at the end.
- #created_by(command, version = 1, options = {}, &block) ⇒ Object
- #load_snapshot(version, &block) ⇒ Object
- #take_snapshot(version, &block) ⇒ Object
Instance Method Details
#applies(event, version = 1, &block) ⇒ Object
7 8 9 |
# File 'lib/euston/aggregate_root_dsl_methods.rb', line 7 def applies event, version = 1, &block define_private_method applies_method_name(event, version), &block end |
#consumes(*arguments, &block) ⇒ Object
*args is an array of symbols plus an optional options hash at the end
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/euston/aggregate_root_dsl_methods.rb', line 11 def consumes *arguments, &block #*args is an array of symbols plus an optional options hash at the end commands, = [], {} while (arg = arguments.shift) do commands << { :name => arg, :version => 1 } if arg.is_a?(Symbol) commands.last[:version] = arg if arg.is_a?(Integer) = arg if arg.is_a?(Hash) end commands.each do |command| define_private_method consumes_method_name(command[:name], command[:version]), &block map_command :map_command_as_aggregate_method, self, command[:name], end end |
#created_by(command, version = 1, options = {}, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/euston/aggregate_root_dsl_methods.rb', line 26 def created_by command, version = 1, = {}, &block define_method consumes_method_name(command, version), &block map_command :map_command_as_aggregate_constructor, self, command, end |
#load_snapshot(version, &block) ⇒ Object
32 33 34 |
# File 'lib/euston/aggregate_root_dsl_methods.rb', line 32 def load_snapshot version, &block define_private_method load_snapshot_method_name(version), &block end |
#take_snapshot(version, &block) ⇒ Object
36 37 38 |
# File 'lib/euston/aggregate_root_dsl_methods.rb', line 36 def take_snapshot version, &block define_private_method take_snapshot_method_name(version), &block end |