るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

検索結果

Forwardable#instance_delegate(hash) -> () (21307.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.l...
...ength # => 5
zap.first # => "foo"
zap.last # => "baz"...