kawakubox
kawakubox
2015/12/11 15:56:51 投稿
0

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

Before

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

After

managers = employees.delete_if { |e| !e.manager? }

みんなのコメント