2件ヒット
[1-2件を表示]
(0.074秒)
検索結果
-
OpenStruct
. new(hash = nil) -> OpenStruct (54703.0) -
OpenStruct オブジェクトを生成します。
...たは each_pair メソッ
ドを持つオブジェクトを用いる事ができます。
@raise NoMethodError hash のキーが to_sym メソッドを持たないときに発生します。
require 'ostruct'
some1 = OpenStruct.new({:a =>"a",:b =>"b"}) # => #<OpenStruct b="b", a="a">... -
OpenStruct
# dig(key , . . . ) -> object | nil (61.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)
per...