Module: EventSourcedRecord::Event::ClassMethods
- Defined in:
- lib/event_sourced_record/event.rb
Instance Method Summary collapse
- #event_type(event_type, &block) ⇒ Object
- #event_type_config(event_type) ⇒ Object
- #event_types ⇒ Object
Instance Method Details
#event_type(event_type, &block) ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/event_sourced_record/event.rb', line 87 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
95 96 97 |
# File 'lib/event_sourced_record/event.rb', line 95 def event_type_config(event_type) self._event_type_configs[event_type] end |
#event_types ⇒ Object
99 100 101 |
# File 'lib/event_sourced_record/event.rb', line 99 def event_types self._event_type_configs.keys end |