From: Fernando Ramos Date: 2009-01-20T02:55:14+09:00 Subject: Re: parsing List results Rob Biedenharn wrote: > On Jan 19, 2009, at 12:00 PM, Fernando Ramos wrote: > >> :aws_instance_id => "i-123f1234", >> :aws_availability_zone => "us-east-1b", >> ========================= >> If so, how do I do that ? >> >> Thank you so much. >> >> Regards. >> > > You can: > require 'pp' > pp @ec2.describe_instances > > or just use #inspect: (which is what irb does with the last expression > anyway) > p @ec2.describe_instances > puts @ec2.describe_instances.inspect > > As for getting the specific key (did you mean 'aws_state'?), perhaps > something like: > @ec2.describe_instances.each do |instance_hash| > puts "%20s: > %s"%instance_hash.values_at(:aws_instance_id, :aws_state) > end > > i-123f1234: running > > You can look at: String#%, Kernel.sprintf, Hash#values_at, and Hash#[] > (oh yeah, and Enumerable#each) for the details. > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob@AgileConsultingLLC.com Hi Rob, You've got it !!! Thank you so much. It is working the way I want now ! Appreciate it ! Regards, Fernando. -- Posted via http://www.ruby-forum.com/.