I think this is beyond [just enough ruby for chef](http://docs.opscode.com/just_enough_ruby_for_chef.html) in a recipe.  Let wrap this into a library function. For example:

`get_ephemeral_devices(cloud)`

This function should also be well documented. i.e. by reading the method comments I should get a good idea of what it does and what it returns -- without needing to understand the code.