るりまサーチ (Ruby 2.7.0)

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

別のキーワード

  1. forwardable delegate
  2. delegate __getobj__
  3. delegate __setobj__
  4. forwardable instance_delegate
  5. delegate delegator

ライブラリ

クラス

モジュール

検索結果

Forwardable#delegate(hash) -> () (54346.0)

メソッドの委譲先を設定します。

メソッドの委譲先を設定します。

@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。


例:

require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@str
delegate [:first, :last] => :@arr
def initialize
@arr = %w/fo...

SingleForwardable#delegate(hash) -> () (54328.0)

メソッドの委譲先を設定します。

メソッドの委譲先を設定します。

@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。

@see Forwardable#delegate

Kernel#DelegateClass(superclass) -> object (42322.0)

クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、 そのクラスを返します。

クラス superclass のインスタンスへメソッドを委譲するクラスを定義し、
そのクラスを返します。

@param superclass 委譲先となるクラス

例:

//emlist{
require 'delegate'

class ExtArray < DelegateClass(Array)
def initialize
super([])
end
end
a = ExtArray.new
p a.class # => ExtArray
a.push 25
p a # => [25]
//}

Delegator#! -> bool (24004.0)

自身を否定します。

自身を否定します。

Delegator#!=(obj) -> bool (24004.0)

自身が与えられたオブジェクトと等しくない場合は、真を返します。 そうでない場合は、偽を返します。

自身が与えられたオブジェクトと等しくない場合は、真を返します。
そうでない場合は、偽を返します。

@param obj 比較対象のオブジェクトを指定します。

絞り込み条件を変える

Delegator#==(obj) -> bool (24004.0)

自身が与えられたオブジェクトと等しい場合は、真を返します。 そうでない場合は、偽を返します。

自身が与えられたオブジェクトと等しい場合は、真を返します。
そうでない場合は、偽を返します。

@param obj 比較対象のオブジェクトを指定します。

Delegator#__getobj__ -> object (24004.0)

委譲先のオブジェクトを返します。

委譲先のオブジェクトを返します。

本メソッドは、サブクラスで再定義する必要があり、
デフォルトでは NotImplementedError が発生します。

@raise NotImplementedError サブクラスにて本メソッドが再定義されていない場合に発生します。

Delegator#__setobj__(obj) -> object (24004.0)

委譲先のオブジェクトをセットします。

委譲先のオブジェクトをセットします。

@param obj 委譲先のオブジェクトを指定します。

@raise NotImplementedError サブクラスにて本メソッドが再定義されていない場合に発生します。

Delegator#freeze -> self (24004.0)

自身を凍結します。

自身を凍結します。

@see Object#freeze

Delegator#marshal_dump -> object (24004.0)

シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。

シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。

絞り込み条件を変える

Delegator#marshal_load(obj) -> object (24004.0)

シリアライズされたオブジェクトから、Delegator#__getobj__ が返すオブジェクトを再現します。

シリアライズされたオブジェクトから、Delegator#__getobj__ が返すオブジェクトを再現します。

@param obj Delegator#marshal_dumpの戻り値のコピー

Delegator#method_missing(m, *args) -> object (24004.0)

渡されたメソッド名と引数を使って、Delegator#__getobj__ が返すオブジェクトへメソッド委譲を行います。

渡されたメソッド名と引数を使って、Delegator#__getobj__ が返すオブジェクトへメソッド委譲を行います。

@param m メソッドの名前(シンボル)

@param args メソッドに渡された引数

@return 委譲先のメソッドからの返り値

@see BasicObject#method_missing

Delegator#methods -> [Symbol] (24004.0)

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

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

@see Object#methods

Delegator#protected_methods(all = true) -> [Symbol] (24004.0)

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

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

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

@see Object#protected_methods

Delegator#public_methods(all = true) -> [Symbol] (24004.0)

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

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

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

@see Object#public_methods

絞り込み条件を変える

Delegator#respond_to?(m) -> bool (24004.0)

Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。

Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。

@param m メソッド名

@see Object#respond_to?

Delegator#respond_to_missing?(m, include_private) -> bool (24004.0)

@param m メソッド名を指定します。

@param m メソッド名を指定します。

@param include_private 真を指定すると private メソッドも調べます。

SimpleDelegator#__getobj__ -> object (24004.0)

委譲先のオブジェクトを返します。

委譲先のオブジェクトを返します。

@see Delegator#__getobj__

SimpleDelegator#__setobj__(obj) -> object (24004.0)

委譲先のオブジェクトを obj に変更します。

委譲先のオブジェクトを obj に変更します。

メソッド委譲を行うためのクラスメソッドの再定義は行われないことに注意してください。
メソッド委譲を行うためのクラスメソッドの定義は生成時にのみ行われます。
そのため、以前の委譲先オブジェクトと
obj の間で呼び出せるメソッドに違いがあった場合は、
何かしらの例外が発生する可能性があります。

@param obj 委譲先のオブジェクト

@return 変更後の委譲先オブジェクト

Forwardable#instance_delegate(hash) -> () (18346.0)

メソッドの委譲先を設定します。

メソッドの委譲先を設定します。

@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。


例:

require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@str
delegate [:first, :last] => :@arr
def initialize
@arr = %w/fo...

絞り込み条件を変える

SingleForwardable#single_delegate(hash) -> () (18328.0)

メソッドの委譲先を設定します。

メソッドの委譲先を設定します。

@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。

@see Forwardable#delegate

Module#ruby2_keywords(method_name, ...) -> nil (22.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...

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

WeakRef#__getobj__ -> object (22.0)

自身の参照先のオブジェクトを返します。

自身の参照先のオブジェクトを返します。

@raise WeakRef::RefError GC 済みのオブジェクトを参照した場合に発生します。

@see delegate