Module: Reading::Util::HashArrayDeepFetch

Defined in:
lib/reading/util/hash_array_deep_fetch.rb

Overview

Similar to Array#dig and Hash#dig but raises an error for not found elements.

Instance Method Summary collapse

Instance Method Details

#deep_fetch(*keys) ⇒ Object



5
6
7
# File 'lib/reading/util/hash_array_deep_fetch.rb', line 5

def deep_fetch(*keys)
  keys.reduce(self) { |a, e| a.fetch(e) }
end