Class: Smith::Events::Subscription
- Inherits:
-
Object
- Object
- Smith::Events::Subscription
- Defined in:
- lib/smith/events/subscription.rb
Instance Attribute Summary collapse
-
#event_class ⇒ Object
readonly
Returns the value of attribute event_class.
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
-
#predicate ⇒ Object
readonly
Returns the value of attribute predicate.
Instance Method Summary collapse
- #cancel ⇒ Object
- #cancelled? ⇒ Boolean
-
#initialize(event_class, handler:, predicate: nil) ⇒ Subscription
constructor
A new instance of Subscription.
Constructor Details
#initialize(event_class, handler:, predicate: nil) ⇒ Subscription
Returns a new instance of Subscription.
8 9 10 11 12 13 |
# File 'lib/smith/events/subscription.rb', line 8 def initialize(event_class, handler:, predicate: nil) @event_class = event_class @handler = handler @predicate = predicate @cancelled = false end |
Instance Attribute Details
#event_class ⇒ Object (readonly)
Returns the value of attribute event_class.
6 7 8 |
# File 'lib/smith/events/subscription.rb', line 6 def event_class @event_class end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
6 7 8 |
# File 'lib/smith/events/subscription.rb', line 6 def handler @handler end |
#predicate ⇒ Object (readonly)
Returns the value of attribute predicate.
6 7 8 |
# File 'lib/smith/events/subscription.rb', line 6 def predicate @predicate end |
Instance Method Details
#cancel ⇒ Object
15 16 17 |
# File 'lib/smith/events/subscription.rb', line 15 def cancel @cancelled = true end |
#cancelled? ⇒ Boolean
19 20 21 |
# File 'lib/smith/events/subscription.rb', line 19 def cancelled? @cancelled end |