Class: ActiveSupport::Callbacks::Filters::After

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/callbacks.rb

Class Method Summary collapse

Class Method Details

.build(next_callback, user_callback, user_conditions, chain_config) ⇒ Object



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'activesupport/lib/active_support/callbacks.rb', line 191

def self.build(next_callback, user_callback, user_conditions, chain_config)
  if chain_config[:skip_after_callbacks_if_terminated]
    if chain_config.key?(:terminator) && user_conditions.any?
      halting_and_conditional(next_callback, user_callback, user_conditions)
    elsif chain_config.key?(:terminator)
      halting(next_callback, user_callback)
    elsif user_conditions.any?
      conditional next_callback, user_callback, user_conditions
    else
      simple next_callback, user_callback
    end
  else
    if user_conditions.any?
      conditional next_callback, user_callback, user_conditions
    else
      simple next_callback, user_callback
    end
  end
end