So I have a hash, and for each level of the hash, I want to store its key and value. The problem is, a value can be another hash array. Furthermore, that hash can contain ke
I recomend to use #deep_locate of hashie gem https://www.rubydoc.info/github/intridea/hashie/Hashie/Extensions/DeepLocate#deep_locate-instance_method
little bit hacky always return false not to seeking
hash.extend(Hashie::Extensions::DeepLocate)
hash.deep_locate -> (key, value, object) do
# what you want to do here!
# key: hash key
# value: hash value
# object: hash_object
false # prevent to stop seeking
end