Module: EventSourcery::Postgres::Reactor::ClassMethods

Defined in:
lib/event_sourcery/postgres/reactor.rb

Instance Method Summary collapse

Instance Method Details

#emit_eventsArray

Returns an array of the types of events this reactor can emit.

Returns:

  • (Array)

    an array of the types of events this reactor can emit



22
23
24
# File 'lib/event_sourcery/postgres/reactor.rb', line 22

def emit_events
  @emits_event_types ||= []
end

#emits_event?(event_type) ⇒ true, false

Will check if this reactor emits the given type of event.

Parameters:

  • event_type

    the event type to check

Returns:

  • (true, false)

    true if it does emit the given event false if not



37
38
39
# File 'lib/event_sourcery/postgres/reactor.rb', line 37

def emits_event?(event_type)
  emit_events.include?(event_type)
end

#emits_events(*event_types) ⇒ Object

Assign the types of events this reactor can emit.

Parameters:

  • event_types

    the types of events this reactor can emit



17
18
19
# File 'lib/event_sourcery/postgres/reactor.rb', line 17

def emits_events(*event_types)
  @emits_event_types = event_types
end

#emits_events?true, false

This will tell you if this reactor emits any type of event.

Returns:

  • (true, false)

    true if this emits events, false if not



29
30
31
# File 'lib/event_sourcery/postgres/reactor.rb', line 29

def emits_events?
  !emit_events.empty?
end