module Falcore::Util

Public Instance Methods

deep_fetch(hash = {}, *keys) click to toggle source

Deeply fech the nested keys, returning nil if an item along the pathway returns nil.

@param [Hash] hash

the hash to deep fetch

@param [Array] keys

the list of keys to fetch (in order)
# 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