Class: RubyEventStore::Subscriptions
- Inherits:
-
Object
- Object
- RubyEventStore::Subscriptions
show all
- Defined in:
- lib/ruby_event_store/subscriptions.rb
Defined Under Namespace
Classes: GlobalSubscriptions, LocalSubscriptions, ThreadGlobalSubscriptions, ThreadLocalSubscriptions, ThreadSubscriptions
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Subscriptions.
Instance Method Details
#add_global_subscription(subscriber) ⇒ Object
17
18
19
|
# File 'lib/ruby_event_store/subscriptions.rb', line 17
def add_global_subscription(subscriber)
global.add(subscriber)
end
|
#add_subscription(subscriber, event_types) ⇒ Object
13
14
15
|
# File 'lib/ruby_event_store/subscriptions.rb', line 13
def add_subscription(subscriber, event_types)
local.add(subscriber, event_types)
end
|
#add_thread_global_subscription(subscriber) ⇒ Object
25
26
27
|
# File 'lib/ruby_event_store/subscriptions.rb', line 25
def add_thread_global_subscription(subscriber)
thread.global.add(subscriber)
end
|
#add_thread_subscription(subscriber, event_types) ⇒ Object
21
22
23
|
# File 'lib/ruby_event_store/subscriptions.rb', line 21
def add_thread_subscription(subscriber, event_types)
thread.local.add(subscriber, event_types)
end
|
#all_for(event_type) ⇒ Object
29
30
31
|
# File 'lib/ruby_event_store/subscriptions.rb', line 29
def all_for(event_type)
[local, global, thread].map { |r| r.all_for(event_type) }.reduce(&:+)
end
|