ostruct.rb

Path: lib/dig_rb/ostruct.rb
Last Update: Sat Feb 23 07:11:54 +0000 2019

Required files

ostruct  

Methods

dig  

Public Instance methods

Retrieves the value object corresponding to the each name objects repeatedly.

  address = OpenStruct.new('city' => "Anytown NC", 'zip' => 12345)
  person = OpenStruct.new('name' => 'John Smith', 'address' => address)
  person.dig(:address, 'zip') # => 12345
  person.dig(:business_address, 'zip') # => nil

[Validate]