Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
p.160 salary_total;after refactoring.
  • Loading branch information
kono committed May 30, 2010
1 parent aec5a65 commit b9336f1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions chapter6/Replace_Loop_with_Collection_Closure_Method.rb
Expand Up @@ -31,7 +31,5 @@ def managerOffices_proc(employees)
end

def salary_total(employees)
total = 0
employees.each{|e| total += e.salary}
total
total = employees.inject(0){|sum, e| sum + e.salary}
end

0 comments on commit b9336f1

Please sign in to comment.