method

halting_and_conditional

Importance_0
v4.1.8 - Show latest stable - 0 notes - Class: Before
halting_and_conditional(next_callback, user_callback, user_conditions, halted_lambda, filter) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/callbacks.rb, line 136
        def self.halting_and_conditional(next_callback, user_callback, user_conditions, halted_lambda, filter)
          lambda { |env|
            target = env.target
            value  = env.value
            halted = env.halted

            if !halted && user_conditions.all? { |c| c.call(target, value) }
              result = user_callback.call target, value
              env.halted = halted_lambda.call(target, result)
              if env.halted
                target.send :halted_callback_hook, filter
              end
            end
            next_callback.call env
          }
        end
Register or log in to add new notes.