るりまサーチ

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

別のキーワード

  1. argf.class each
  2. argf.class each_line
  3. argf.class lines
  4. class new
  5. argf.class readlines

ライブラリ

モジュール

検索結果

Kernel#DelegateClass(superclass) -> object (24319.0)

クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、 そのクラスを返します。

...クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、
そのクラスを返します。

@param superclass 委譲先となるクラス

例:

//emlist{
require 'delegate'

class
ExtArray < DelegateClass(Array)
def initialize
super([])
end
end
a = E...
...xtArray.new
p a.class # => ExtArray
a.push 25
p a # => [25]
//}...

NEWS for Ruby 2.7.0 (42.0)

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

...ted です。 15575
この警告は「-W:no-deprecated」オプションで止められます。

//emlist{
def foo
class
<< Object.new
yield #=> warning: `yield' in class syntax will not be supported from Ruby 3.0. 15575
end
end
foo { p :ok }
//}

* 引数を転送する記法「(...)...
...sday?) #=> next Tuesday
//}
//emlist[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
p e.class #=> Enumerator
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
//}
//emlist[Enumerator::Lazy#with_index][ruby]{
("a"..).lazy...
...1, Date.parseが新しい日本の年号を
サポートしました。 15742

* Delegator
* Object#DelegateClassがブロックを受け付けるようになり、
Class
.newやStruct.newのように返り値のクラスのコンテキストで
module_evalするようにな...