Permalink
Browse files

use inject rather than multiple assignments

  • Loading branch information...
1 parent ba55276 commit d2405a0aab6b246842163cdb1a40d2d300b7b879 @tenderlove tenderlove committed May 14, 2013
Showing with 2 additions and 4 deletions.
  1. +2 −4 activesupport/lib/active_support/callbacks.rb
@@ -540,11 +540,9 @@ def initialize_copy(other)
def compile
return @callbacks if @callbacks
- @callbacks = Filters::ENDING
- @chain.reverse_each do |callback|
- @callbacks = callback.apply(@callbacks)
+ @callbacks = @chain.reverse.inject(Filters::ENDING) do |chain, callback|
+ callback.apply chain
end
- @callbacks
end
def append(*callbacks)

0 comments on commit d2405a0

Please sign in to comment.