Class: Fidgit::Event::Subscription
Overview
Created and returned by #subscribe and can be used to unsubscribe from the event.
Instance Attribute Summary (collapse)
-
- (Object) event
readonly
Returns the value of attribute event.
-
- (Object) handler
readonly
Returns the value of attribute handler.
-
- (Object) publisher
readonly
Returns the value of attribute publisher.
Instance Method Summary (collapse)
-
- (Subscription) initialize(publisher, event, handler)
constructor
A new instance of Subscription.
- - (Object) unsubscribe
Constructor Details
- (Subscription) initialize(publisher, event, handler)
A new instance of Subscription
30 31 32 33 34 35 36 |
# File 'lib/fidgit/event.rb', line 30 def initialize(publisher, event, handler) raise TypeError unless publisher.is_a? Event raise TypeError unless event.is_a? Symbol raise TypeError unless handler.is_a? Proc or handler.is_a? Method @publisher, @event, @handler = publisher, event, handler end |
Instance Attribute Details
- (Object) event (readonly)
Returns the value of attribute event
28 29 30 |
# File 'lib/fidgit/event.rb', line 28 def event @event end |
- (Object) handler (readonly)
Returns the value of attribute handler
28 29 30 |
# File 'lib/fidgit/event.rb', line 28 def handler @handler end |
- (Object) publisher (readonly)
Returns the value of attribute publisher
28 29 30 |
# File 'lib/fidgit/event.rb', line 28 def publisher @publisher end |
Instance Method Details
- (Object) unsubscribe
38 39 40 |
# File 'lib/fidgit/event.rb', line 38 def unsubscribe @publisher.unsubscribe self end |