Class: ProconBypassMan::Callbacks::CallbackChain

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/support/callbacks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCallbackChain

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

#callbacksObject

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

Returns:

  • (Boolean)


51
52
53
# File 'lib/procon_bypass_man/support/callbacks.rb', line 51

def empty?
  callbacks.empty?
end