How to parse hashes in Ruby?

Example on the Repl.

As for Ruby go through the whole hash to the attachments, preferably without recursion.
An example from the Repl.it is one show is equal to true taken it.
You also need to look at the value of the show have children.

But if the object is child, he vkluchaetsia from the sample. But it chil's no.
For example, there is such a hash.
{
"aaa"=>{"show"=>true},
"bbb"=>{"show"=>false},
"ccc"=>{
"show"=>true,
"child"=>{
"child_1"=>{"show"=>true},
"child_2"=>{"show"=>false}
}
},
"ddd"=>{"show"=>false}
}

Need to parse so that would be the end to that.
{:aaa=>123, :child_1=>123}
March 20th 20 at 11:35
1 answer
March 20th 20 at 11:37
Solution
If the maximum nesting level is not known, it does

Find more questions by tags Ruby on Rails