るりまサーチ

最速Rubyリファレンスマニュアル検索!
34件ヒット [1-34件を表示] (0.103秒)
トップページ > クエリ:t[x] > クエリ:method[x] > クエリ:OpenStruct[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

クラス

キーワード

検索結果

OpenStruct (44048.0)

要素を動的に追加・削除できる手軽な構造体を提供するクラスです。

...動的に追加・削除できる手軽な構造体を提供するクラスです。

OpenStruct
のインスタンスに対して未定義なメソッド x= を呼ぶと、
OpenStruct
クラスの BasicObject#method_missing で捕捉され、そのインスタンスに
インスタンスメソッ...
...ます。

require 'ostruct'
ab = OpenStruct.new
ab.foo = 25
p ab.foo # => 25
ab.bar = 2
p ab.bar # => 2
p ab # => <OpenStruct foo=25, bar=2>
ab.delete_field("foo")
p ab.foo # => nil
p ab # => <OpenStruct bar=2>

初期化に...
...truct'
son = OpenStruct.new({ :name => "Thomas", :age => 3 })
p son.name # => "Thomas"
p son.age # => 3
son.age += 1
p son.age # => 4
son.items = ["candy","toy"]
p son.items # => ["candy","toy"]
p son # => #<OpenStruct name="Thomas", age=4, it...

Array#dig(idx, ...) -> object | nil (112.0)

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

...ます。

//emlist[例][ruby]{
a = [[1, [2, 3]]]

a.dig(0, 1, 1) # => 3
a.dig(1, 2, 3) # => nil
a.dig(0, 0, 0) # => TypeError: Fixnum does not have #dig method
[42, {foo: :bar}].dig(1, :foo) # => :bar
//}

@see Hash#dig, Struct#dig, OpenStruct#dig...
...ます。

//emlist[例][ruby]{
a = [[1, [2, 3]]]

a.dig(0, 1, 1) # => 3
a.dig(1, 2, 3) # => nil
a.dig(0, 0, 0) # => TypeError: Integer does not have #dig method
[42, {foo: :bar}].dig(1, :foo) # => :bar
//}

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

NEWS for Ruby 2.0.0 (90.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ーディングを US-ASCII から UTF-8 に変更しました
* '_' で始まる使用されていない変数は警告しなくなりました

=== 組み込みクラスの更新

* ARGF.class
* 追加: ARGF.class#codepoints, ARGF.class#each_codepoint
IO にある同名のメソッ...
....prepended, Module.prepend_features は Module.included と Module.append_features に似ています
* 追加(実験的): Module#refine, スコープを限定してクラスやモジュールを拡張します。
* 拡張: Module#define_method は UnboundMethod を受け付けるように...
...ations where FIPS mode would be an
explicit requirement.
* Authenticated Encryption with Associated Data (AEAD) is supported via
Cipher#auth_data= and Cipher#auth_tag/Cipher#auth_tag=.
Currently (OpenSSL 1.0.1c), only GCM mode is supported.

* ostruct
* 追加: OpenStruct...