# File lib/rudy/aws/ec2/instance.rb, line 108
108:       def destroy(inst_ids=[], &each_inst)
109:         instances = list(:running, inst_ids, &each_inst) || [] 
110:         raise NoRunningInstances if instances.empty?
111:       
112:         inst_ids = objects_to_instance_ids(inst_ids)
113:             
114:         response = Rudy::AWS::EC2.execute_request({}) {
115:           @@ec2.terminate_instances(:instance_id => inst_ids)
116:         }
117:       
118:         #instancesSet: 
119:         #  item: 
120:         #  - instanceId: i-ebdcb882
121:         #    shutdownState: 
122:         #      code: "48"
123:         #      name: terminated
124:         #    previousState: 
125:         #      code: "48"
126:         #      name: terminated
127:       
128:         raise MalformedResponse unless response['instancesSet'].is_a?(Hash)
129:         instances_shutdown = []
130:         response['instancesSet']['item'].collect do |inst|
131:           next unless inst['shutdownState'].is_a?(Hash) && inst['shutdownState']['name'] == 'shutting-down'
132:           instances_shutdown << inst['instanceId']
133:         end
134:         success = instances_shutdown.size == inst_ids.size
135:         success
136:       end