Class: Space::Events::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/space/events/subscription.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(observer, types) ⇒ Subscription

Returns a new instance of Subscription.



6
7
8
9
# File 'lib/space/events/subscription.rb', line 6

def initialize(observer, types)
  @observer = observer
  @types    = types
end

Instance Attribute Details

#observerObject (readonly)

Returns the value of attribute observer.



4
5
6
# File 'lib/space/events/subscription.rb', line 4

def observer
  @observer
end

#typesObject (readonly)

Returns the value of attribute types.



4
5
6
# File 'lib/space/events/subscription.rb', line 4

def types
  @types
end

Instance Method Details

#notify(event) ⇒ Object



11
12
13
# File 'lib/space/events/subscription.rb', line 11

def notify(event)
  observer.notify(event) if matches?(event)
end