るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.127秒)

別のキーワード

  1. string []=
  2. string slice!
  3. string slice
  4. string []
  5. string gsub!

ライブラリ

モジュール

検索結果

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

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

...。キーは Symbol、
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) -> () (15322.0)

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

...。キーは Symbol、
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"...