dstautberg/Test-App — comment on commit dda7ea3621cd876549442552ac9e37864bc30a7c
File: show.rb line 25
By mattyoho:

Well, Aaron Patterson and Ryan Davis would probably slap a Ruby dev for using #inject when the iteration result doesn't rely on the previous step. (There's also a performance penalty.)

In this case, though, there's a clear argument for #map.

doc.css("#mycarousel a").map do |link|
Show.from_link_element(link)
end

doc.css("#maycarousel a") is an array of anchor elements; we can just "transpose" that into an array of Show instances directly.