るりまサーチ

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

別のキーワード

  1. irb/input-method gets
  2. irb/input-method new
  3. _builtin define_method
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

種類

ライブラリ

検索結果

OpenStruct (38060.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>

初期化にハッシ...
...re 'ostruct'
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...

NEWS for Ruby 3.0.0 (282.0)

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

...a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern...
...e, String => x, String => y, *post]
p pre #=> ["a", 1]
p x #=> "b"
p y #=> "c"
p post #=> [2, "d", "e", "f", 3]
end
//}

* Endless method definition is added. [EXPERIMENTAL]
16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no longer frozen when...
...variables with no special behavior.
C-API methods related to `$SAFE` have been removed.
16131 17136
* yield in singleton class definitions in methods is now a SyntaxError
instead of a warning. yield in a class definition outside of a method
is now a SyntaxError instead of a LocalJ...