Class: Space::Events::Subscription
- Inherits:
-
Object
- Object
- Space::Events::Subscription
- Defined in:
- lib/space/events/subscription.rb
Instance Attribute Summary collapse
-
#observer ⇒ Object
readonly
Returns the value of attribute observer.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(observer, types) ⇒ Subscription
constructor
A new instance of Subscription.
- #notify(event) ⇒ Object
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
#observer ⇒ Object (readonly)
Returns the value of attribute observer.
4 5 6 |
# File 'lib/space/events/subscription.rb', line 4 def observer @observer end |
#types ⇒ Object (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 |