dog = {
"name" => "Fido",
"color" => "black",
"age" => 3,
"isHungry" => "true",
"enemies" => ["squirrel"],
}
dog["location"] = "NY"
dog["age"] += 10
dog["enemies"] << "mailman"
puts dog
------------------------------
#=>
{"name"=>"Fido", "color"=>"black", "age"=>13, "isHungry"=>"true", "enemies"=>["squirrel", "mailman"], "location"=>"NY"}
dog = {
"name" => "Fido",
"color" => "black",
"age" => 3,
"isHungry" => "true",
"enemies" => ["squirrel"],
}
puts dog.has_key?("color")
puts dog.has_key?("location")
puts dog.has_key?("Color")
puts dog.has_value?(false)
puts dog.has_value?(3)
p dog.keys[1]
p dog.values
-------------------------------
#=>
true
false
false
false
true
color
["Fido", "black", 3, "true", ["squirrel"]]