Module: Synapse::EventSourcing::Member::ClassMethods

Defined in:
lib/synapse/event_sourcing/member.rb

Instance Method Summary collapse

Instance Method Details

#child_entitiesSet

Returns a set of symbols referring to child entities

Returns:

  • (Set)


32
33
34
# File 'lib/synapse/event_sourcing/member.rb', line 32

def child_entities
  @child_entities ||= Set.new
end

#child_entity(*fields) ⇒ undefined

Registers an instance variable as a child entity

Parameters:

  • fields (Symbol...)

Returns:

  • (undefined)


24
25
26
27
28
# File 'lib/synapse/event_sourcing/member.rb', line 24

def child_entity(*fields)
  fields.each do |field|
    child_entities.add field.to_s
  end
end

#map_command(type, *args, &block) ⇒ undefined

Parameters:

  • type (Class)
  • args (Object...)
  • block (Proc)

Returns:

  • (undefined)

See Also:

  • Mapper#map


41
42
43
# File 'lib/synapse/event_sourcing/member.rb', line 41

def map_command(type, *args, &block)
  commnad_mapper.map type, *args, &block
end

#map_event(type, *args, &block) ⇒ undefined

Parameters:

  • type (Class)
  • args (Object...)
  • block (Proc)

Returns:

  • (undefined)

See Also:

  • Mapper#map


50
51
52
# File 'lib/synapse/event_sourcing/member.rb', line 50

def map_event(type, *args, &block)
  event_mapper.map type, *args, &block
end