るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.015秒)
トップページ > クエリ:g=[x] > 種類:モジュール[x]

別のキーワード

  1. openssl g=
  2. openssl g
  3. dh g=
  4. dsa g=
  5. dh g

ライブラリ

検索結果

SingleForwardable (7.0)

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

...を定義するモジュールです。

=== 使い方

オブジェクトに対して extend して使います。

例:

require 'forwardable'
g =
Goo.new
g.extend SingleForwardable
g.def_delegator("@out", :puts)
g.puts ...

また、SingleForwardable はクラスやモジュールに対...
...ようにする事もできます。

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...