# File lib/rudy/aws/ec2/image.rb, line 39
39:       def list_as_hash(owner=[], image_ids=[], executable_by=[], &each_image)
40:         owner &&= [owner].flatten.compact
41:         image_ids &&= [image_ids].flatten.compact
42:         executable_by &&= [executable_by].flatten.compact
43:         
44:         # Remove dashes from aws account numbers
45:         owner &&= owner.collect { |o| o.tr('-', '') }
46:         # If we got Image objects, we want just the IDs.
47:         # This method always returns an Array.
48:         image_ids = objects_to_image_ids(image_ids)
49:         
50:         opts = {
51:           :owner_id => owner || [],
52:           :image_id => image_ids || [],
53:           :executable_by => executable_by || []
54:         }
55:         
56:         response = Rudy::AWS::EC2.execute_request({}) { @@ec2.describe_images(opts) }
57:         
58:         return nil unless response['imagesSet'].is_a?(Hash)  # No instances 
59:       
60:         resids = []
61:         images = {}
62:         response['imagesSet']['item'].each do |res|      
63:           resids << res['reservationId']
64:           img = Images.from_hash(res)
65:           images[img.awsid] = img
66:         end
67:         
68:         images.each_value { |image| each_image.call(image) } if each_image
69:         
70:         images = nil if images.empty? # Don't return an empty hash
71:         images
72:       end