From: Robert Klemme Date: 2012-12-09T21:48:53+09:00 Subject: Re: Searching a hash by value On Sun, Dec 9, 2012 at 1:35 PM, Ferdous ara wrote: > but will this work : #value["host_display_name"] ?? > I will try in a bit .. No. For lookup by value you can use Hash#rassoc: irb(main):003:0> h={"foo" => "bar"} => {"foo"=>"bar"} irb(main):004:0> h.rassoc "bar" => ["foo", "bar"] irb(main):005:0> key, val = h.rassoc "bar" => ["foo", "bar"] irb(main):006:0> key => "foo" Be warned though that this may be inefficient. You probably want a second Hash keyed by value. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/