Module: CiteProc::Extensions::DeepFetch

Included in:
Hash
Defined in:
lib/citeproc/extensions.rb

Instance Method Summary collapse

Instance Method Details

#[](*arguments) ⇒ Object



29
30
31
32
# File 'lib/citeproc/extensions.rb', line 29

def [](*arguments)
  return super if arguments.length == 1
  deep_fetch(*arguments)
end

#deep_fetch(*arguments) ⇒ Object



25
26
27
# File 'lib/citeproc/extensions.rb', line 25

def deep_fetch(*arguments)
  arguments.reduce(self) { |s,a| s[a] } rescue nil
end