instance_delegate(hash) -> ()
[permalink][rdoc]delegate(hash) -> ()
メソッドの委譲先を設定します。
例:
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"