class OpenStruct

def dig(name, *names)


data.dig(:array, 0, 0) # TypeError: Integer does not have #dig method
data.dig(:array, 1, 0) # => 2

data = OpenStruct.new(:array => [1, [2, 3]])

person.dig(:business_address, "zip") # => nil
person.dig(:address, "zip") # => 12345

person = OpenStruct.new("name" => "John Smith", "address" => address)
address = OpenStruct.new("city" => "Anytown NC", "zip" => 12345)
require "ostruct"

intermediate step is +nil+.
objects by calling +dig+ at each step, returning +nil+ if any
Extracts the nested value specified by the sequence of +name+

ostruct.dig(name, ...) -> object
:call-seq:
def dig(name, *names)
  begin
    name = name.to_sym
  rescue NoMethodError
    raise TypeError, "#{name} is not a symbol nor a string"
  end
  @table.dig(name, *names)
end