jessedoyle / prawn-icon

Easy icons for Prawn.
Other
28 stars 15 forks source link

Simplify code using Ruby's tap method #20

Closed jessedoyle closed 8 years ago

jessedoyle commented 8 years ago

It was common to see the following code:

arr = []

items.each do |i|
  arr << i # something more elaborate here...
end

arr

This PR simplifies the codebase by using tap:

[].tap do |arr|
  items.each do |i|
    arr << i
  end
end