Module: Stealth::Controller::Callbacks::ClassMethods
- Defined in:
- lib/stealth/controller/callbacks.rb
Instance Method Summary collapse
- #_insert_callbacks(callbacks, block = nil) ⇒ Object
- #_normalize_callback_option(options, from, to) ⇒ Object
- #_normalize_callback_options(options) ⇒ Object
Instance Method Details
#_insert_callbacks(callbacks, block = nil) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/stealth/controller/callbacks.rb', line 30 def _insert_callbacks(callbacks, block = nil) = callbacks. () callbacks.push(block) if block callbacks.each do |callback| yield callback, end end |
#_normalize_callback_option(options, from, to) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/stealth/controller/callbacks.rb', line 22 def _normalize_callback_option(, from, to) if from = [from] _from = Array(from).map(&:to_s).to_set from = proc { |c| _from.include?(c.action_name) } [to] = Array([to]).unshift(from) end end |
#_normalize_callback_options(options) ⇒ Object
17 18 19 20 |
# File 'lib/stealth/controller/callbacks.rb', line 17 def () _normalize_callback_option(, :only, :if) _normalize_callback_option(, :except, :unless) end |