Phlip
1/19/2009 6:57:00 PM
Fernando Ramos wrote:
> puts @ec2.describe_instances
>
> the results comes like this :
> =========================
> aws_image_idami-e444444daws_reasonaws_state_codeaws_owner000000000888aws_instance_id
> i-123f1234aws_reservation_idr-aabbccddaws_staterunningdns_name
> domU-12-34-67-89-01-C9.usma2.compute.amazonaws.comssh_key_namestagingaws_groups
puts outputs strings, so it calls .to_s on its argument.
..to_s on a hash calls .to_s on all its keys and values, and mashes them together.
Use p @ec2.describe_instances, or require 'pp' and use pp.
> Is there a way of accessing a specific key, for example : aws_status ?
> If so, how do I do that ?
p @ec2.describe_instances[2][:aws_status]
Now play around with (and read the docs on) Array and Hash!