るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.052秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:singleton[x] > クエリ:singleton[x] > クラス:Object[x] > クエリ:protected_methods[x]

別のキーワード

  1. singleton instance
  2. object define_singleton_method
  3. _builtin define_singleton_method
  4. singleton clone
  5. singleton dup

検索結果

Object#protected_methods(include_inherited = true) -> [Symbol] (18116.0)

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

...解できる protected メソッド名の一覧を返します。

@param include_inherited 偽となる値を指定すると自身のクラスのスーパークラスで定義されたメソッドを除きます。


@see Module#protected_instance_methods,Object#methods,Object#singleton_methods...

Object#methods(include_inherited = true) -> [Symbol] (207.0)

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

...メソッドの名前を返します。

ただし特別に、引数が偽の時は Object#singleton_methods(false) と同じになっています。


@param include_inherited 引数が偽の時は Object#singleton_methods(false) と同じになります。

//emlist[例1][ruby]{
class Parent
pr...
...ate_singleton() end
protected; def protected_singleton() end
public; def public_singleton() end
end

# あるオブジェクトの応答できるメソッドの一覧を得る。
p obj.methods(false)
p obj.public_methods(false)
p obj.private_methods(false)
p obj.protected_methods(fal...
...se)

# 実行結果
[:protected_singleton, :public_singleton]
[:public_singleton, :public_foo]
[:private_singleton, :private_foo]
[:protected_singleton, :protected_foo]
//}


//emlist[例2][ruby]{
# あるオブジェクトの応答できるメソッドの一覧を得る。
# 自身のクラスの...