るりまサーチ

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

別のキーワード

  1. _builtin length
  2. digest digest_length
  3. digest block_length
  4. set length
  5. enclosure length

ライブラリ

モジュール

検索結果

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