Skip to content

Commit

Permalink
Merge pull request #18885 from ypxing/master
Browse files Browse the repository at this point in the history
remove unnecessary assignment/parameter passing in AS::Callbacks...::Around (master branch)
  • Loading branch information
rafaelfranca committed Feb 12, 2015
2 parents 9e9a3c5 + b82500e commit 6eaadd9
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions activesupport/lib/active_support/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,11 @@ def self.halting_and_conditional(callback_sequence, user_callback, user_conditio

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
Expand All @@ -309,11 +307,10 @@ def self.halting(callback_sequence, user_callback)
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
Expand All @@ -328,12 +325,11 @@ def self.conditional(callback_sequence, user_callback, user_conditions)

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
Expand All @@ -342,8 +338,7 @@ def self.conditional(callback_sequence, user_callback, user_conditions)
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
Expand Down

0 comments on commit 6eaadd9

Please sign in to comment.