ruby access hash by key code example
Example 1: how to access hash value ruby
my_hash.values_at("key1", "key2") #=> ["value1", "value2"]
Example 2: ruby get key
hash = {"apple" => "fruit", "carrot" => "vegetable"}
array = hash.keys #=> ["apple", "carrot"]
Example 3: how to access hash value ruby
my_hash["key"] #=> "value"