Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/lbf/deep_fetch.rb

Instance Method Summary collapse

Instance Method Details

#deep_fetch(*args) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/lbf/deep_fetch.rb', line 2

def deep_fetch(*args)
  key = args.shift
  val = self.fetch(key, nil)
  return val if args.length == 0
  return nil if val.nil? || !val.respond_to?(:deep_fetch)
  val.deep_fetch(*args)
end