On Fri, Jan 18, 2013 at 8:09 PM, robert lengu <[email protected]> wrote:
> Hi
> i need some guide to complete my task
> basically i am doing this
>
> if  result.has_key?("t")
>         p result["t"]
> end
>
>
>
> "host1"=>{"valu1"=>{"value2"=>[{"t-1"=>"Fri Jan 18 01:46:15 SAST
> 2013"}]}, "value3"=>{"start"=>"xxxx", "value4"=>"xxxx"}},
> "host2"=>{"value1"=>{"vaue2"=>[{"t-8"=>"Fri Jan 18 01:51:59 SAST
> 2013"}]}, "value3"=>{"start"=>"xxxxx", "value4"=>"xxxx"}}}
>
>
> but i need to further query in that hash for value t-1,
> So if value t-1 is present in this hash then it will say "Found"

Can you please give a complete example?  In the outermost Hash there
does not seem to be a key "t" and it is really unclear what you want
to achieve.

As an additional hint: better store timestamps as instances of Time or
DateTime.  That makes processing them a lot easier.

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- 
[email protected] | 
https://groups.google.com/d/forum/ruby-talk-google?hl=en


Reply via email to