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

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

Class Method Summary collapse

Class Method Details

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


195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/active_support/callbacks.rb', line 195

def self.build(callback_sequence, 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(callback_sequence, user_callback, user_conditions)
    elsif chain_config.key?(:terminator)
      halting(callback_sequence, user_callback)
    elsif user_conditions.any?
      conditional callback_sequence, user_callback, user_conditions
    else
      simple callback_sequence, user_callback
    end
  else
    if user_conditions.any?
      conditional callback_sequence, user_callback, user_conditions
    else
      simple callback_sequence, user_callback
    end
  end
end