Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > delegateライブラリ > Delegatorクラス

class Delegator

クラスの継承リスト: Delegator < Delegator::MethodDelegation < Object < Kernel < BasicObject

要約

サブクラスにメソッド委譲の仕組みを提供する抽象クラス。

メソッド委譲を行う場合は、本クラスを継承しDelegator#__getobj__を再定義する必要があります。

具体的な使用例については、SimpleDelegatorを参照してください。

インスタンスメソッド

定義 説明
! -> bool

自身を否定します。

self != obj -> bool

自身が与えられたオブジェクトと等しくない場合は、真を返します。 そうでない場合は、偽を返します。

self == obj -> bool

自身が与えられたオブジェクトと等しい場合は、真を返します。 そうでない場合は、偽を返します。

__getobj__ -> object

委譲先のオブジェクトを返します。

__setobj__(obj)

委譲先のオブジェクトをセットします。

freeze

自身を凍結します。

marshal_dump -> object

シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。

marshal_load(obj) -> object

シリアライズされたオブジェクトから、Delegator#__getobj__ が返すオブジェクトを再現します。

method_missing(m, *args) -> object

渡されたメソッド名と引数を使って、Delegator#__getobj__ が返すオブジェクトへメソッド委譲を行います。

methods -> [Symbol]

そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。

protected_methods(all = true) -> [Symbol]

そのオブジェクトが理解できる protected メソッド名の一覧を返します。

public_methods(all = true) -> [Symbol]

そのオブジェクトが理解できる public メソッド名の一覧を返します。

respond_to?(m) -> bool

Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。

respond_to_missing?(m, include_private) -> bool

@param m メソッド名を指定します。

継承したメソッド

clone equal? === =~ __id__ __send__ _dump class dclone display enum_for eql? extend frozen? hash initialize initialize_copy inspect instance_eval instance_exec instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? method must_be must_be_close_to must_be_empty must_be_instance_of must_be_kind_of must_be_nil must_be_same_as must_be_within_epsilon must_equal must_include must_match must_raise must_respond_to must_send must_throw nil? pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods remove_instance_variable singleton_class singleton_method_added singleton_method_removed singleton_method_undefined singleton_methods taint tainted? tap to_a to_ary to_hash to_int to_io to_proc to_regexp to_s to_str to_yaml to_yaml_properties to_yaml_style trust untaint untrust untrusted? wont_be wont_be_close_to wont_be_empty wont_be_instance_of wont_be_kind_of wont_be_nil wont_be_same_as wont_be_within_epsilon wont_equal wont_include wont_match wont_respond_to .new