Module: Falcore::Util
Instance Method Summary collapse
-
#deep_fetch(hash = {}, *keys) ⇒ Object
Deeply fech the nested keys, returning
nilif an item along the pathway returnsnil.
Instance Method Details
#deep_fetch(hash = {}, *keys) ⇒ Object
Deeply fech the nested keys, returning nil if an item along the pathway returns nil.
32 33 34 35 36 37 |
# File 'lib/falcore/util.rb', line 32 def deep_fetch(hash = {}, *keys) keys.inject(hash.dup) do |hash, key| return nil if hash.nil? hash[key] end end |