Flowdock
method

conditional

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: Around
conditional(callback_sequence, user_callback, user_conditions) 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 322
        def self.conditional(callback_sequence, user_callback, user_conditions)
          callback_sequence.around do |env, &run|
            target = env.target
            value  = env.value

            if user_conditions.all? { |c| c.call(target, value) }
              user_callback.call(target, value) {
                env = run.call env
                env.value
              }
              env
            else
              run.call env
            end
          end
        end
Register or log in to add new notes.