るりまサーチ

最速Rubyリファレンスマニュアル検索!
9件ヒット [1-9件を表示] (0.062秒)
トップページ > クエリ:Hash#key[x] > クエリ:new[x] > クエリ:include?[x] > クエリ:slice[x] > クエリ:key[x] > クラス:OpenStruct[x]

別のキーワード

  1. openssl public_key
  2. openssl public_key=
  3. _builtin each_key
  4. socket pf_key
  5. dbm key

ライブラリ

検索結果

OpenStruct#dig(key, ...) -> object | nil (114.0)

self 以下のネストしたオブジェクトを dig メソッドで再帰的に参照して返し ます。途中のオブジェクトが nil であった場合は nil を返します。

...ジェクトが nil であった場合は nil を返します。

@param key キーを任意個指定します。

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

@see Array#dig, Hash#dig, Struct#dig...