Module: RubyDig
- Included in:
- Array, Hash, OpenStruct
- Defined in:
- lib/jamf/ruby_extensions/dig.rb
Overview
modulize monkey patches
Instance Method Summary collapse
Instance Method Details
#dig(key, *rest) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jamf/ruby_extensions/dig.rb', line 29 def dig(key, *rest) value = self[key] if value.nil? || rest.empty? value elsif value.respond_to?(:dig) value.dig(*rest) else raise TypeError, "#{value.class} does not have #dig method" end end |