Class: BatchKit::Events::Subscription
- Inherits:
-
Object
- Object
- BatchKit::Events::Subscription
- Defined in:
- lib/batch-kit/events.rb
Overview
Records subscription details
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#raise_on_error ⇒ Object
readonly
Returns the value of attribute raise_on_error.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #===(obj) ⇒ Object
-
#initialize(source, event, options, callback) ⇒ Subscription
constructor
A new instance of Subscription.
Constructor Details
#initialize(source, event, options, callback) ⇒ Subscription
Returns a new instance of Subscription.
29 30 31 32 33 34 |
# File 'lib/batch-kit/events.rb', line 29 def initialize(source, event, , callback) @source = source @event = event @raise_on_error = .fetch(:raise_on_error, true) @callback = callback end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
26 27 28 |
# File 'lib/batch-kit/events.rb', line 26 def callback @callback end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
26 27 28 |
# File 'lib/batch-kit/events.rb', line 26 def event @event end |
#raise_on_error ⇒ Object (readonly)
Returns the value of attribute raise_on_error.
26 27 28 |
# File 'lib/batch-kit/events.rb', line 26 def raise_on_error @raise_on_error end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
26 27 28 |
# File 'lib/batch-kit/events.rb', line 26 def source @source end |
Instance Method Details
#===(obj) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/batch-kit/events.rb', line 37 def ===(obj) @source.nil? || # Nil source means match any obj (@source == obj) || # Source is obj (@source === obj) || # obj is an instance of source class (@source.instance_of?(Module) && obj.instance_of?(Class) && obj.include?(@source)) # Source is a module included by obj end |