Module: Webmate::Responders::Callbacks::ClassMethods
- Defined in:
- lib/webmate/responders/callbacks.rb
Instance Method Summary collapse
- #_insert_callbacks(callbacks, block) ⇒ Object
- #_normalize_callback_options(options) ⇒ Object
- #skip_filter(*names, &blk) ⇒ Object
Instance Method Details
#_insert_callbacks(callbacks, block) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/webmate/responders/callbacks.rb', line 30 def _insert_callbacks(callbacks, block) = callbacks.last.is_a?(Hash) ? callbacks.pop : {} () callbacks.push(block) if block callbacks.each do |callback| yield callback, end end |
#_normalize_callback_options(options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/webmate/responders/callbacks.rb', line 19 def () if only = [:only] only = Array(only).map {|o| "action_method == '#{o}'"}.join(" || ") [:per_key] = {:if => only} end if except = [:except] except = Array(except).map {|e| "action_method == '#{e}'"}.join(" || ") [:per_key] = {:unless => except} end end |
#skip_filter(*names, &blk) ⇒ Object
39 40 41 42 43 |
# File 'lib/webmate/responders/callbacks.rb', line 39 def skip_filter(*names, &blk) skip_before_filter(*names) skip_after_filter(*names) skip_around_filter(*names) end |