るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. handler end_sequence

ライブラリ

モジュール

検索結果

Forwardable#instance_delegate(hash) -> () (18213.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"...