7stud2
(7stud --)
1
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"
how can i do that ??
Thanks for your help.
···
--
Posted via http://www.ruby-forum.com/.
Robert_K1
(Robert K.)
2
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
···
On Fri, Jan 18, 2013 at 8:09 PM, robert lengu <lists@ruby-forum.com> 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"
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/