J
Jon Baer
Going through pick-axe and was just wondering if there was a one
liner for something such as this that I may have missed:
h2 = Hash.new
h1 = {"foo1"=>"bar1", "foo2"=>"bar2"}
query = h1.select { |k,v| v == "bar2" }
query.each do |result|
h2[result[0]] = result[1]
end
p h2
Thanks.
- Jon
liner for something such as this that I may have missed:
h2 = Hash.new
h1 = {"foo1"=>"bar1", "foo2"=>"bar2"}
query = h1.select { |k,v| v == "bar2" }
query.each do |result|
h2[result[0]] = result[1]
end
p h2
Thanks.
- Jon