Use Enumerable#find_all instead of #each

Hey @andrew, just refactoring the code to determine the list of dependencies a bit _(no functional changes to the script whatsoever)_.

This change simplifies the Ruby code a wee bit, as we don't have to create & build up the array of dependencies ourselves!

Cheers!