Class: RubyEventStore::PubSub::Subscriptions
- Inherits:
-
Object
- Object
- RubyEventStore::PubSub::Subscriptions
show all
- Defined in:
- lib/ruby_event_store/pub_sub/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
16
17
18
|
# File 'lib/ruby_event_store/pub_sub/subscriptions.rb', line 16
def add_global_subscription(subscriber)
global.add(subscriber)
end
|
#add_subscription(subscriber, event_types) ⇒ Object
12
13
14
|
# File 'lib/ruby_event_store/pub_sub/subscriptions.rb', line 12
def add_subscription(subscriber, event_types)
local.add(subscriber, event_types)
end
|
#add_thread_global_subscription(subscriber) ⇒ Object
24
25
26
|
# File 'lib/ruby_event_store/pub_sub/subscriptions.rb', line 24
def add_thread_global_subscription(subscriber)
thread.global.add(subscriber)
end
|
#add_thread_subscription(subscriber, event_types) ⇒ Object
20
21
22
|
# File 'lib/ruby_event_store/pub_sub/subscriptions.rb', line 20
def add_thread_subscription(subscriber, event_types)
thread.local.add(subscriber, event_types)
end
|
#all_for(event_type) ⇒ Object
28
29
30
|
# File 'lib/ruby_event_store/pub_sub/subscriptions.rb', line 28
def all_for(event_type)
[local, global, thread].map{|r| r.all_for(event_type)}.reduce(&:+)
end
|