Skip to content

Commit

Permalink
p.159 "Replace Loop with Collection Closure Method";replace loop abou…
Browse files Browse the repository at this point in the history
…t manager with closure method.
  • Loading branch information
kono committed May 30, 2010
1 parent 483d0b2 commit 4b21f32
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions chapter6/Replace_Loop_with_Collection_Closure_Method.rb
Expand Up @@ -16,9 +16,5 @@ def manager?

def test_proc(employees)

managers = []
employees.each do |e|
managers << e if e.manager?
end
managers
managers = employees.select{|e| e.manager?}
end

0 comments on commit 4b21f32

Please sign in to comment.