Class: RailsEventSourcing::Dispatcher::ReactorSet

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-event-sourcing/dispatcher.rb

Overview

Contains sync and async reactors. Used to:

  • store reactors via Rules#register

  • return a set of matching reactors with Rules#for

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeReactorSet

Returns a new instance of ReactorSet.



69
70
71
72
# File 'lib/rails-event-sourcing/dispatcher.rb', line 69

def initialize
  @sync = Set.new
  @async = Set.new
end

Instance Attribute Details

#asyncObject (readonly)

Returns the value of attribute async.



67
68
69
# File 'lib/rails-event-sourcing/dispatcher.rb', line 67

def async
  @async
end

#syncObject (readonly)

Returns the value of attribute sync.



67
68
69
# File 'lib/rails-event-sourcing/dispatcher.rb', line 67

def sync
  @sync
end

Instance Method Details

#add_async(reactors) ⇒ Object



78
79
80
# File 'lib/rails-event-sourcing/dispatcher.rb', line 78

def add_async(reactors)
  @async += reactors
end

#add_sync(reactors) ⇒ Object



74
75
76
# File 'lib/rails-event-sourcing/dispatcher.rb', line 74

def add_sync(reactors)
  @sync += reactors
end