るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

検索結果

Forwardable#delegate(hash) -> () (24215.0)

メソッドの委譲先を設定します。

...String かその配列で指定します。


例:

require 'forwardable'
class Zap
extend Forwardable
delegate
:length => :@str
delegate
[:first, :last] => :@arr
def initialize
@arr = %w/foo bar baz/
@str = "world"
end
end

zap = Zap.new
zap.length...
...# => 5
zap.first # => "foo"
zap.last # => "baz"...

Forwardable#instance_delegate(hash) -> () (15315.0)

メソッドの委譲先を設定します。

...String かその配列で指定します。


例:

require 'forwardable'
class Zap
extend Forwardable
delegate
:length => :@str
delegate
[:first, :last] => :@arr
def initialize
@arr = %w/foo bar baz/
@str = "world"
end
end

zap = Zap.new
zap.length...
...# => 5
zap.first # => "foo"
zap.last # => "baz"...