# File lib/hashie/extensions/deep_fetch.rb, line 16 def deep_fetch(*args, &block) args.reduce(self) do |obj, arg| begin arg = Integer(arg) if obj.kind_of? Array obj.fetch(arg) rescue ArgumentError, IndexError => e break block.call(arg) if block raise UndefinedPathError, "Could not fetch path (#{args.join(' > ')}) at #{arg}", e.backtrace end end end