São iguais?
Crie uma função que receba dois hashes e uma chave.
- Retorne
truese ambas as entradas contiverem a chave com valores iguais. - Retorne
"One's empty"se apenas uma das entradas contiver a chave. - Retorne
"Not the same"se ambas as entradas contiverem valores diferentes ou se nenhuma delas contiver a chave.
Exemplos
check_same({ "sky" => "temple", "horde" => "orcs", "people" => 12, "story" => "fine", "sun" => "bright" }, { "people" => 12, "sun" => "star", "book" => "bad" }, "horde") # "One's empty"
check_same({ "sky" => "temple", "horde" => "orcs", "people" => 12, "story" => "fine", "sun" => "bright" }, { "people" => 12, "sun" => "star", "book" => "bad" }, "people") # true
check_same({ "sky" => "temple", "horde" => "orcs", "people" => 12, "story" => "fine", "sun" => "bright" }, { "people" => 12, "sun" => "star", "book" => "bad" }, "sun") # "Not the same"Observações
- A ordem das chaves não importa.
- Uma chave com um valor
nilainda é considerada presente.