るりまサーチ (Ruby 2.7.0)

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

別のキーワード

  1. module attr
  2. module new
  3. module constants
  4. module module_eval
  5. module define_method

検索結果

Module#instance_methods(inherited_too = true) -> [Symbol] (81544.0)

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

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

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

@see Object#methods

//emlist[例1][ruby]{
class Foo
private; def private_foo() end
protected; def protected_foo() end
public; def public_foo() end
end

# あるクラスのインスタンス...

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

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

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

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

@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...

Module#protected_instance_methods(inherited_too = true) -> [Symbol] (81364.0)

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

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

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


@see Object#protected_methods, Module#instance_methods

Module#public_instance_methods(inherited_too = true) -> [Symbol] (81364.0)

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

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

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


@see Object#public_methods, Module#instance_methods

Module#ruby2_keywords(method_name, ...) -> nil (63157.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method 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 method to other methods.

For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword argument...

絞り込み条件を変える

Module#undef_method(*name) -> self (63115.0)

このモジュールのインスタンスメソッド name を未定義にします。

このモジュールのインスタンスメソッド name を未定義にします。

@param name 0 個以上の String か Symbol を指定します。

@raise NameError 指定したインスタンスメソッドが定義されていない場合に発生します。

=== 「未定義にする」とは
このモジュールのインスタンスに対して name という
メソッドを呼び出すことを禁止するということです。
スーパークラスの定義が継承されるかどうかという点において、
「未定義」は「メソッドの削除」とは区別されます。
以下のコード例を参照してください。

//emlist[例][ruby]{
class A
...

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

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

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

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


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

//emlist[例1][ruby]{
class Parent
private; def private_parent() end
protecte...

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

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

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

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

singleton_methods(false) は、Object#methods(false) と同じです。

@param inherited_too 継承した特異メソッドを含める場合は...

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

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

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

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


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

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

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

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

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


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

絞り込み条件を変える

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

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

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

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


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

UnboundMethod (97.0)

レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。

レシーバを持たないメソッドを表すクラスです。
呼び出すためにはレシーバにバインドする必要があります。

Module#instance_method や
Method#unbind により生成し、後で
UnboundMethod#bind によりレシーバを
割り当てた Method オブジェクトを作ることができます。

//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のようになります。][ruby]{
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz...

Proc#ruby2_keywords -> proc (73.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.

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 ...