Class: ActiveSupport::Callbacks::Filters::After
- Defined in:
- lib/active_support/callbacks.rb
Instance Attribute Summary collapse
-
#halting ⇒ Object
readonly
Returns the value of attribute halting.
-
#user_callback ⇒ Object
readonly
Returns the value of attribute user_callback.
-
#user_conditions ⇒ Object
readonly
Returns the value of attribute user_conditions.
Instance Method Summary collapse
- #apply(callback_sequence) ⇒ Object
- #call(env) ⇒ Object
-
#initialize(user_callback, user_conditions, chain_config) ⇒ After
constructor
A new instance of After.
Constructor Details
#initialize(user_callback, user_conditions, chain_config) ⇒ After
Returns a new instance of After.
195 196 197 198 199 |
# File 'lib/active_support/callbacks.rb', line 195 def initialize(user_callback, user_conditions, chain_config) halting = chain_config[:skip_after_callbacks_if_terminated] @user_callback, @user_conditions, @halting = user_callback, user_conditions, halting freeze end |
Instance Attribute Details
#halting ⇒ Object (readonly)
Returns the value of attribute halting.
194 195 196 |
# File 'lib/active_support/callbacks.rb', line 194 def halting @halting end |
#user_callback ⇒ Object (readonly)
Returns the value of attribute user_callback.
194 195 196 |
# File 'lib/active_support/callbacks.rb', line 194 def user_callback @user_callback end |
#user_conditions ⇒ Object (readonly)
Returns the value of attribute user_conditions.
194 195 196 |
# File 'lib/active_support/callbacks.rb', line 194 def user_conditions @user_conditions end |
Instance Method Details
#apply(callback_sequence) ⇒ Object
213 214 215 |
# File 'lib/active_support/callbacks.rb', line 213 def apply(callback_sequence) callback_sequence.after(self) end |
#call(env) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/active_support/callbacks.rb', line 201 def call(env) target = env.target value = env.value halted = env.halted if (!halted || !@halting) && user_conditions.all? { |c| c.call(target, value) } user_callback.call target, value end env end |