るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.016秒)
トップページ > クエリ:Class[x] > バージョン:2.2.0[x] > 種類:モジュール[x] > クエリ:Forwardable[x]

別のキーワード

  1. argf.class lines
  2. argf.class each_line
  3. argf.class each
  4. class new
  5. argf.class readline

ライブラリ

検索結果

Forwardable (114058.0)

クラスに対し、メソッドの委譲機能を定義するモジュールです。

...し、メソッドの委譲機能を定義するモジュールです。

=== 使い方

クラスに対して Object#extend して使います。Module#include でないところに注意して下さい。

例:

require 'forwardable'
class Foo
extend Forwardable

def_delegators("@o...

SingleForwardable (18076.0)

オブジェクトに対し、メソッドの委譲機能を定義するモジュールです。

...ようにする事もできます。

require 'forwardable'
class Implementation
def self.service
puts "serviced!"
end
end

module
Facade
extend SingleForwardable
def_delegator :Implementation, :service
end

Facade.service # => serviced!

もし Forwardable と Si...