User no image
anonymous
2015/12/15 11:43:37 投稿
1

【Refactor Me】もっと短く書けそう...

Before

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

After

managers = employees.select(&:manager?)

みんなのコメント