るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. kernel $-p

ライブラリ

クラス

検索結果

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

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

...のメソッドは public メソッドおよび protected メソッドの名前を返します。

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


@param include_inherited 引数が偽の時は Object#singleton_methods(false) と同じ...
...s Parent
p
rivate; def private_parent() end
p
rotected; def protected_parent() end
p
ublic; def public_parent() end
end

class Foo < Parent
p
rivate; def private_foo() end
p
rotected; def protected_foo() end
p
ublic; def public_foo() end
end

obj = Foo.new
class <<obj
p
...
...e; def private_singleton() end
p
rotected; def protected_singleton() end
p
ublic; def public_singleton() end
end

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

Object#private_methods(include_inherited = true) -> [Symbol] (12327.0)

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

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

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


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

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

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

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

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


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

Object#public_methods(include_inherited = true) -> [Symbol] (12327.0)

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

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

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


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

Module#private_instance_methods(inherited_too = true) -> [Symbol] (12232.0)

そのモジュールで定義されている private メソッド名 の一覧を配列で返します。

... private メソッド名
の一覧を配列で返します。

@param inherited_too false を指定するとそのモジュールで定義されているメソッドのみ返します。

@see Object#private_methods, Module#instance_methods

//emlist[例][ruby]{
module Foo
def foo; end
p
rivat...
...e def bar; end
end

module Bar
include
Foo

def baz; end
p
rivate def qux; end
end

Bar.private_instance_methods # => [:qux, :bar]
Bar.private_instance_methods(false) # => [:qux]
//}...

絞り込み条件を変える

Refinement#import_methods(*modules) -> self (12232.0)

モジュールからメソッドをインポートします。

...モジュールからメソッドをインポートします。

Module#includeと違って、import_methods はメソッドをコピーして
refinement に追加して、refinementでインポートしたメソッドを有効化します。

メソッドをコピーするため、Rubyコードで...
...level)
' ' * level + self
end
end

module M
refine String do
import_methods StrUtils
end
end

using M
p
"foo".indent(3) # => " foo"

module M
refine String do
import_methods Enumerable
# Can't import method which is not defined with Ruby code: Enumerable#drop
end
end
//}...

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

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

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

inherited_too が真のときは継承した特異メソッドを含みます。
継承した特異メソッドとは Object#extend によって追...
...eton_methods(false) は、Object#methods(false) と同じです。

@param inherited_too 継承した特異メソッドを含める場合は真を、
そうでない場合は偽を指定します。

//emlist[例1][ruby]{
P
arent = Class.new

class <<Parent
p
rivate; def priva...
..._class_parent() end
p
rotected; def protected_class_parent() end
p
ublic; def public_class_parent() end
end

Foo = Class.new(Parent)

class <<Foo
p
rivate; def private_class_foo() end
p
rotected; def protected_class_foo() end
p
ublic; def public_class_foo() end
end

module Bar
p
rivate...

Proc#ruby2_keywords -> proc (3133.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...e proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked with a sp...
...f a normal argument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed through the proc to other methods.

This should only be used for procs that delegate ke...
...another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before calling
it. Als...