Class: ActiveSupport::Callbacks::Filters::After
- Defined in:
- activesupport/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.
196 197 198 199 200 |
# File 'activesupport/lib/active_support/callbacks.rb', line 196 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.
195 196 197 |
# File 'activesupport/lib/active_support/callbacks.rb', line 195 def halting @halting end |
#user_callback ⇒ Object (readonly)
Returns the value of attribute user_callback.
195 196 197 |
# File 'activesupport/lib/active_support/callbacks.rb', line 195 def user_callback @user_callback end |
#user_conditions ⇒ Object (readonly)
Returns the value of attribute user_conditions.
195 196 197 |
# File 'activesupport/lib/active_support/callbacks.rb', line 195 def user_conditions @user_conditions end |
Instance Method Details
#apply(callback_sequence) ⇒ Object
214 215 216 |
# File 'activesupport/lib/active_support/callbacks.rb', line 214 def apply(callback_sequence) callback_sequence.after(self) end |
#call(env) ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 |
# File 'activesupport/lib/active_support/callbacks.rb', line 202 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 |