るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.023秒)
トップページ > バージョン:2.3.0[x] > クエリ:new[x] > ライブラリ:delegate[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

クラス

モジュール

キーワード

検索結果

SimpleDelegator.new(obj) -> object (54328.0)

メソッドを委譲するオブジェクトの設定と、 メソッド委譲を行うためのクラスメソッドの定義を行います。

メソッドを委譲するオブジェクトの設定と、
メソッド委譲を行うためのクラスメソッドの定義を行います。

@param obj 委譲先のオブジェクト

@see Delegator.new

SimpleDelegator (43.0)

Delegator クラスを継承し、シンプルなメソッド委譲を実現した具象クラス。

...し、シンプルなメソッド委譲を実現した具象クラス。

委譲先に指定されたオブジェクトへメソッドの実行を委譲します。

例:

//emlist{
require 'delegate'

foo = Object.new
def foo.test
p 25
end
foo2 = SimpleDelegator.new(foo)
foo2.test # => 25
//}...

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

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

...クラスを定義し、
そのクラスを返します。

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

例:

//emlist{
require 'delegate'

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