class RubyEventStore::Subscriptions::LocalSubscriptions

Public Class Methods

new() click to toggle source
# File lib/ruby_event_store/subscriptions.rb, line 50
def initialize
  @subscriptions = Hash.new { |hsh, key| hsh[key] = [] }
end

Public Instance Methods

add(subscription, event_types) click to toggle source
# File lib/ruby_event_store/subscriptions.rb, line 54
def add(subscription, event_types)
  event_types.each { |type| @subscriptions[type] << subscription }
  -> { event_types.each { |type| @subscriptions.fetch(type).delete(subscription) } }
end
all_for(event_type) click to toggle source
# File lib/ruby_event_store/subscriptions.rb, line 59
def all_for(event_type)
  @subscriptions[event_type]
end