Module: Skinny::Callbacks::InstanceMethods
- Defined in:
- lib/skinny.rb
Instance Method Summary collapse
Instance Method Details
#add_callback(name, &block) ⇒ Object
26 27 28 29 30 |
# File 'lib/skinny.rb', line 26 def add_callback name, &block @callbacks ||= {} @callbacks[name] ||= [] @callbacks[name] << block end |
#callback(name, *args, &block) ⇒ Object
32 33 34 35 |
# File 'lib/skinny.rb', line 32 def callback name, *args, &block return [] if @callbacks.nil? || @callbacks[name].nil? @callbacks[name].collect { |callback| callback.call *args, &block } end |