121件ヒット
[1-100件を表示]
(0.066秒)
モジュール
- Enumerable (22)
キーワード
- grep (22)
- methods (11)
-
private
_ instance _ methods (11) -
private
_ methods (11) -
protected
_ instance _ methods (11) -
protected
_ methods (11) -
public
_ instance _ methods (11) -
public
_ methods (11) -
undef
_ method (11)
検索結果
先頭5件
- Module
# instance _ methods(inherited _ too = true) -> [Symbol] - Module
# private _ instance _ methods(inherited _ too = true) -> [Symbol] - Module
# protected _ instance _ methods(inherited _ too = true) -> [Symbol] - Module
# public _ instance _ methods(inherited _ too = true) -> [Symbol] - Object
# methods(include _ inherited = true) -> [Symbol]
-
Module
# instance _ methods(inherited _ too = true) -> [Symbol] (18175.0) -
そのモジュールで定義されている public および protected メソッド名 の一覧を配列で返します。
...end
end
# あるクラスのインスタンスメソッドの一覧を得る
p Foo.instance_methods(false)
p Foo.public_instance_methods(false)
p Foo.private_instance_methods(false)
p Foo.protected_instance_methods(false)
class Bar < Foo
end
//}
実行結果
[:protected_foo, :public_foo]......r.instance_methods(true) - Object.instance_methods(true)
p Bar.public_instance_methods(true) - Object.public_instance_methods(true)
p Bar.private_instance_methods(true) - Object.private_instance_methods(true)
p Bar.protected_instance_methods(true) - Object.protected_instance_methods(t... -
Module
# private _ instance _ methods(inherited _ too = true) -> [Symbol] (6121.0) -
そのモジュールで定義されている private メソッド名 の一覧を配列で返します。
...@see Object#private_methods, Module#instance_methods
//emlist[例][ruby]{
module Foo
def foo; end
private def bar; end
end
module Bar
include Foo
def baz; end
private def qux; end
end
Bar.private_instance_methods # => [:qux, :bar]
Bar.private_instance_methods(false) # => [:qux]
//}... -
Module
# protected _ instance _ methods(inherited _ too = true) -> [Symbol] (6109.0) -
そのモジュールで定義されている protected メソッド名 の一覧を配列で返します。
...そのモジュールで定義されている protected メソッド名
の一覧を配列で返します。
@param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。
@see Object#protected_methods, Module#instance_methods... -
Module
# public _ instance _ methods(inherited _ too = true) -> [Symbol] (6109.0) -
そのモジュールで定義されている public メソッド名 の一覧を配列で返します。
...そのモジュールで定義されている public メソッド名
の一覧を配列で返します。
@param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。
@see Object#public_methods, Module#instance_methods... -
Object
# methods(include _ inherited = true) -> [Symbol] (32.0) -
そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。
...obj.methods(true) - Object.instance_methods(true)
p obj.public_methods(true) - Object.public_instance_methods(true)
p obj.private_methods(true) - Object.private_instance_methods(true)
p obj.protected_methods(true) - Object.protected_instance_methods(true)
# 実行結果
[:protected_s......ublic_singleton, :protected_foo, :public_foo, :protected_parent, :public_parent]
[:public_singleton, :public_foo, :public_parent]
[:private_singleton, :private_foo, :private_parent]
[:protected_singleton, :protected_foo, :protected_parent]
//}
@see Module#instance_methods,Object#singleton_methods... -
Module
# undef _ method(*name) -> self (26.0) -
このモジュールのインスタンスメソッド name を未定義にします。
...module M1
def foo
end
def self.moo
undef foo
end
end
M1.instance_methods false #=> ["foo"]
M1.moo
M1.instance_methods false #=> []
module M2
def foo
end
def self.moo
undef_method :foo
end
end
M2.instance_methods false #=> ["foo"]
M2.moo
M2.instance_methods false #=> []
//}... -
Enumerable
# grep(pattern) -> [object] (8.0) -
pattern === item が成立する要素を全て含んだ配列を返します。
...返します。
@param pattern 「===」メソッドを持つオブジェクトを指定します。
//emlist[例][ruby]{
['aa', 'bb', 'cc', 'dd', 'ee'].grep(/[bc]/) # => ["bb", "cc"]
Array.instance_methods.grep(/gr/) # => [:grep, :group_by]
//}
@see Enumerable#select
@see Enumerable#grep_v... -
Enumerable
# grep(pattern) {|item| . . . } -> [object] (8.0) -
pattern === item が成立する要素を全て含んだ配列を返します。
...返します。
@param pattern 「===」メソッドを持つオブジェクトを指定します。
//emlist[例][ruby]{
['aa', 'bb', 'cc', 'dd', 'ee'].grep(/[bc]/) # => ["bb", "cc"]
Array.instance_methods.grep(/gr/) # => [:grep, :group_by]
//}
@see Enumerable#select
@see Enumerable#grep_v... -
Object
# private _ methods(include _ inherited = true) -> [Symbol] (8.0) -
そのオブジェクトが理解できる private メソッド名の一覧を返します。
...が理解できる private メソッド名の一覧を返します。
@param include_inherited 偽となる値を指定すると自身のクラスのスーパークラスで定義されたメソッドを除きます。
@see Module#private_instance_methods,Object#methods,Object#singleton_methods... -
Object
# protected _ methods(include _ inherited = true) -> [Symbol] (8.0) -
そのオブジェクトが理解できる protected メソッド名の一覧を返します。
...解できる protected メソッド名の一覧を返します。
@param include_inherited 偽となる値を指定すると自身のクラスのスーパークラスで定義されたメソッドを除きます。
@see Module#protected_instance_methods,Object#methods,Object#singleton_methods...