I have been given down the client , there is a quick ruby method (without typing a multi -script script) I want to match client_id? Like how to get the key to client_id == "2180"
?
client = {"yellow" => {"Client_id" = "2178"}, "orange" => {"Client_id" = "gt 2180"}, "red" = & gt; {"Client_id" = "gt 2179"}, "blue" => {"Client_id" = & gt; "2181"}
You can use:
clients.select {| Key, hash | Hash ["client_id"] == "2180"} # = & gt; [["Orange", {"client_id" => "2180"}]
Note that the result will be an array of all mailing values, where each key has a key and value.
Comments
Post a Comment