るりまサーチ

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

別のキーワード

  1. csv instance
  2. forwardable instance_delegate
  3. _builtin instance_eval
  4. prime instance
  5. singleton instance

ライブラリ

モジュール

検索結果

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

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

...uire '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#delegate(hash) -> () (13.0)

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

...uire '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"...