aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-12 15:09:57 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-02-12 15:09:57 -0200
commit6eaadd9fc194b3a594b6aea7fb8f91a4a06ce1aa (patch)
treee6840da770437f2405488e183353875f47b0f35e /activesupport/lib
parent9e9a3c53142d711910816d6bf0402847ffb4a34f (diff)
parentb82500e396b728f6dea42916fe3d491d7ba4224d (diff)
downloadrails-6eaadd9fc194b3a594b6aea7fb8f91a4a06ce1aa.tar.gz
rails-6eaadd9fc194b3a594b6aea7fb8f91a4a06ce1aa.tar.bz2
rails-6eaadd9fc194b3a594b6aea7fb8f91a4a06ce1aa.zip
Merge pull request #18885 from ypxing/master
remove unnecessary assignment/parameter passing in AS::Callbacks...::Around (master branch)
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/callbacks.rb19
1 files changed, 7 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 0d5035f637..51cf468d2b 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -291,13 +291,11 @@ module ActiveSupport
if !halted && user_conditions.all? { |c| c.call(target, value) }
user_callback.call(target, value) {
- env = run.call env
- env.value
+ run.call.value
}
-
env
else
- run.call env
+ run.call
end
end
end
@@ -309,11 +307,10 @@ module ActiveSupport
value = env.value
if env.halted
- run.call env
+ run.call
else
user_callback.call(target, value) {
- env = run.call env
- env.value
+ run.call.value
}
env
end
@@ -328,12 +325,11 @@ module ActiveSupport
if user_conditions.all? { |c| c.call(target, value) }
user_callback.call(target, value) {
- env = run.call env
- env.value
+ run.call.value
}
env
else
- run.call env
+ run.call
end
end
end
@@ -342,8 +338,7 @@ module ActiveSupport
def self.simple(callback_sequence, user_callback)
callback_sequence.around do |env, &run|
user_callback.call(env.target, env.value) {
- env = run.call env
- env.value
+ run.call.value
}
env
end