2件ヒット
[1-2件を表示]
(0.027秒)
別のキーワード
モジュール
- Forwardable (2)
キーワード
-
def
_ delegator (1) -
def
_ instance _ delegator (1)
検索結果
先頭2件
-
Forwardable
# def _ delegator(accessor , method , ali = method) -> () (328.0) -
メソッドの委譲先を設定します。
...require 'forwardable'
class MyQueue
extend Forwardable
attr_reader :queue
def initialize
@queue = []
end
def_delegator :@queue, :push, :mypush
end
q = MyQueue.new
q.mypush 42
q.queue # => [42]
q.push 23 # => NoMethodError
@see Forwardable#def_delegato... -
Forwardable
# def _ instance _ delegator(accessor , method , ali = method) -> () (328.0) -
メソッドの委譲先を設定します。
...require 'forwardable'
class MyQueue
extend Forwardable
attr_reader :queue
def initialize
@queue = []
end
def_delegator :@queue, :push, :mypush
end
q = MyQueue.new
q.mypush 42
q.queue # => [42]
q.push 23 # => NoMethodError
@see Forwardable#def_delegato...