Class: ActiveSupport::Callbacks::Filters::Before

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, filter) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'activesupport/lib/active_support/callbacks.rb', line 120

def self.build(next_callback, user_callback, user_conditions, chain_config, filter)
  halted_lambda = chain_config[:terminator]

  if chain_config.key?(:terminator) && user_conditions.any?
    halting_and_conditional(next_callback, user_callback, user_conditions, halted_lambda, filter)
  elsif chain_config.key? :terminator
    halting(next_callback, user_callback, halted_lambda, filter)
  elsif user_conditions.any?
    conditional(next_callback, user_callback, user_conditions)
  else
    simple next_callback, user_callback
  end
end