Module: EventSourcedRecord::Event::ClassMethods

Defined in:
lib/event_sourced_record/event.rb

Instance Method Summary collapse

Instance Method Details

#event_type(event_type, &block) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/event_sourced_record/event.rb', line 92

def event_type(event_type, &block)
  scope event_type, -> { where(event_type: event_type) }
  self._event_type_configs ||= HashWithIndifferentAccess.new
  config = EventTypeConfig.new
  self._event_type_configs[event_type] = config
  config.instance_eval(&block)
end

#event_type_config(event_type) ⇒ Object



100
101
102
# File 'lib/event_sourced_record/event.rb', line 100

def event_type_config(event_type)
  self._event_type_configs[event_type]
end

#event_typesObject



104
105
106
# File 'lib/event_sourced_record/event.rb', line 104

def event_types
  self._event_type_configs.keys
end