Class: ProconBypassMan::Callbacks::CallbackChain
- Inherits:
-
Object
- Object
- ProconBypassMan::Callbacks::CallbackChain
- Defined in:
- lib/procon_bypass_man/support/callbacks.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
Instance Method Summary collapse
- #[](filter) ⇒ Object
- #append(callback) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ CallbackChain
constructor
A new instance of CallbackChain.
Constructor Details
#initialize ⇒ CallbackChain
Returns a new instance of CallbackChain.
47 48 49 |
# File 'lib/procon_bypass_man/support/callbacks.rb', line 47 def initialize self.callbacks = {} end |
Instance Attribute Details
#callbacks ⇒ Object
Returns the value of attribute callbacks.
45 46 47 |
# File 'lib/procon_bypass_man/support/callbacks.rb', line 45 def callbacks @callbacks end |
Instance Method Details
#[](filter) ⇒ Object
60 61 62 |
# File 'lib/procon_bypass_man/support/callbacks.rb', line 60 def [](filter) self.callbacks[filter] end |
#append(callback) ⇒ Object
55 56 57 58 |
# File 'lib/procon_bypass_man/support/callbacks.rb', line 55 def append(callback) self.callbacks[callback.filter] ||= [] self.callbacks[callback.filter] << callback end |
#empty? ⇒ Boolean
51 52 53 |
# File 'lib/procon_bypass_man/support/callbacks.rb', line 51 def empty? callbacks.empty? end |