るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.082秒)

別のキーワード

  1. mutex_m extend_object
  2. json extend
  3. irb/extend-command def_extend_command
  4. irb/extend-command install_extend_commands
  5. module extend_object

ライブラリ

クラス

検索結果

Object#singleton_methods(inherited_too = true) -> [Symbol] (18156.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...承した特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。

singleton_methods
(false) は、Object#methods(false) と同...
...class <<obj
include
Bar
private; def private_self() end
protected; def protected_self() end
public; def public_self() end
end

# あるオブジェクトの特異メソッドの一覧を得る。
p obj.singleton_methods(false)
p obj.methods(false)
p Foo.singleton_methods(false)

#...
...p obj.singleton_methods(true)
p Foo.singleton_methods(true) - Object.singleton_methods(true)

#実行結果

[:protected_self, :public_self, :protected_bar, :public_bar]
[:protected_class_foo, :public_class_foo, :protected_class_parent, :public_class_parent]
//}

@see Object#methods,Object#extend...