ライブラリ
- ビルトイン (2)
- delegate (20)
- forwardable (4)
- openssl (1)
- weakref (2)
クラス
- Delegator (14)
- Module (1)
- Proc (1)
- SimpleDelegator (3)
- WeakRef (1)
モジュール
- Forwardable (2)
- Kernel (1)
-
OpenSSL
:: OCSP (1) - SingleForwardable (2)
キーワード
- ! (1)
- != (1)
- == (1)
- DelegateClass (1)
- Delegator (1)
-
NEWS for Ruby 2
. 7 . 0 (1) - NODELEGATED (1)
- Ruby用語集 (1)
- SimpleDelegator (1)
- WeakRef (1)
-
_ _ getobj _ _ (3) -
_ _ setobj _ _ (2) - freeze (1)
-
instance
_ delegate (1) -
marshal
_ dump (1) -
marshal
_ load (1) -
method
_ missing (1) - methods (1)
- new (1)
-
protected
_ methods (1) -
public
_ methods (1) -
respond
_ to? (1) -
respond
_ to _ missing? (1) -
ruby 1
. 8 . 3 feature (1) -
ruby2
_ keywords (2) -
single
_ delegate (1)
検索結果
先頭5件
-
delegate (150001.0)
-
メソッドの委譲 (delegation) を行うためのライブラリです。
メソッドの委譲 (delegation) を行うためのライブラリです。
Delegator クラスは指定したオブジェクトにメソッドの実行を委譲します。
Delegator クラスを利用する場合はこれを継承して
Delegator#__getobj__ メソッドを再定義して委譲先のオブジェクトを指定します。
SimpleDelegator は Delegator の利用例の一つであり、
コンストラクタに渡されたオブジェクトにメソッドの実行を委譲します。
Kernel#DelegateClass は 引数で渡されたクラスのインスタンスをひとつとり、
そのオブジェクトにインスタンスメソッド... -
Forwardable
# delegate(hash) -> () (90943.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) -> () (90925.0) -
メソッドの委譲先を設定します。
メソッドの委譲先を設定します。
@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。
@see Forwardable#delegate -
Kernel
# DelegateClass(superclass) -> object (79063.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
# marshal _ dump -> object (60601.0) -
シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。
シリアライゼーションをサポートするためにDelegator#__getobj__ が返すオブジェクトを返します。 -
Delegator
# marshal _ load(obj) -> object (60601.0) -
シリアライズされたオブジェクトから、Delegator#__getobj__ が返すオブジェクトを再現します。
シリアライズされたオブジェクトから、Delegator#__getobj__ が返すオブジェクトを再現します。
@param obj Delegator#marshal_dumpの戻り値のコピー -
SimpleDelegator (60019.0)
-
Delegator クラスを継承し、シンプルなメソッド委譲を実現した具象クラス。
Delegator クラスを継承し、シンプルなメソッド委譲を実現した具象クラス。
委譲先に指定されたオブジェクトへメソッドの実行を委譲します。
例:
//emlist{
require 'delegate'
foo = Object.new
def foo.test
p 25
end
foo2 = SimpleDelegator.new(foo)
foo2.test # => 25
//} -
Delegator (60001.0)
-
サブクラスにメソッド委譲の仕組みを提供する抽象クラス。
サブクラスにメソッド委譲の仕組みを提供する抽象クラス。
メソッド委譲を行う場合は、本クラスを継承しDelegator#__getobj__を再定義する必要があります。
具体的な使用例については、SimpleDelegatorを参照してください。 -
Forwardable
# instance _ delegate(hash) -> () (54943.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) -> () (54925.0) -
メソッドの委譲先を設定します。
メソッドの委譲先を設定します。
@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。
@see Forwardable#delegate -
OpenSSL
:: OCSP :: NODELEGATED -> Integer (54901.0) -
delegated trust を許可しないことを意味します。
delegated trust を許可しないことを意味します。
このフラグ定数は使われていません。 -
Delegator
# method _ missing(m , *args) -> object (42601.0) -
渡されたメソッド名と引数を使って、Delegator#__getobj__ が返すオブジェクトへメソッド委譲を行います。
渡されたメソッド名と引数を使って、Delegator#__getobj__ が返すオブジェクトへメソッド委譲を行います。
@param m メソッドの名前(シンボル)
@param args メソッドに渡された引数
@return 委譲先のメソッドからの返り値
@see BasicObject#method_missing -
Delegator
# protected _ methods(all = true) -> [Symbol] (42601.0) -
そのオブジェクトが理解できる protected メソッド名の一覧を返します。
そのオブジェクトが理解できる protected メソッド名の一覧を返します。
@param all 偽を指定すると __getobj__ のスーパークラスで定義されたメソッドを除きます。
@see Object#protected_methods -
Delegator
# public _ methods(all = true) -> [Symbol] (42601.0) -
そのオブジェクトが理解できる public メソッド名の一覧を返します。
そのオブジェクトが理解できる public メソッド名の一覧を返します。
@param all 偽を指定すると __getobj__ のスーパークラスで定義されたメソッドを除きます。
@see Object#public_methods -
Delegator
# respond _ to _ missing?(m , include _ private) -> bool (42601.0) -
@param m メソッド名を指定します。
@param m メソッド名を指定します。
@param include_private 真を指定すると private メソッドも調べます。 -
Delegator
# ! -> bool (42001.0) -
自身を否定します。
自身を否定します。 -
Delegator
# !=(obj) -> bool (42001.0) -
自身が与えられたオブジェクトと等しくない場合は、真を返します。 そうでない場合は、偽を返します。
自身が与えられたオブジェクトと等しくない場合は、真を返します。
そうでない場合は、偽を返します。
@param obj 比較対象のオブジェクトを指定します。 -
Delegator
# ==(obj) -> bool (42001.0) -
自身が与えられたオブジェクトと等しい場合は、真を返します。 そうでない場合は、偽を返します。
自身が与えられたオブジェクトと等しい場合は、真を返します。
そうでない場合は、偽を返します。
@param obj 比較対象のオブジェクトを指定します。 -
Delegator
# _ _ getobj _ _ -> object (42001.0) -
委譲先のオブジェクトを返します。
委譲先のオブジェクトを返します。
本メソッドは、サブクラスで再定義する必要があり、
デフォルトでは NotImplementedError が発生します。
@raise NotImplementedError サブクラスにて本メソッドが再定義されていない場合に発生します。 -
Delegator
# _ _ setobj _ _ (obj) -> object (42001.0) -
委譲先のオブジェクトをセットします。
委譲先のオブジェクトをセットします。
@param obj 委譲先のオブジェクトを指定します。
@raise NotImplementedError サブクラスにて本メソッドが再定義されていない場合に発生します。 -
Delegator
# freeze -> self (42001.0) -
自身を凍結します。
自身を凍結します。
@see Object#freeze -
Delegator
# methods -> [Symbol] (42001.0) -
そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。
そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。
このメソッドは public メソッドおよび protected メソッドの名前を返します。
@see Object#methods -
Delegator
# respond _ to?(m) -> bool (42001.0) -
Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。
Delegator#__getobj__ が返すオブジェクトが メソッド m を持つとき真を返します。
@param m メソッド名
@see Object#respond_to? -
SimpleDelegator
# _ _ getobj _ _ -> object (42001.0) -
委譲先のオブジェクトを返します。
委譲先のオブジェクトを返します。
@see Delegator#__getobj__ -
SimpleDelegator
# _ _ setobj _ _ (obj) -> object (42001.0) -
委譲先のオブジェクトを obj に変更します。
委譲先のオブジェクトを obj に変更します。
メソッド委譲を行うためのクラスメソッドの再定義は行われないことに注意してください。
メソッド委譲を行うためのクラスメソッドの定義は生成時にのみ行われます。
そのため、以前の委譲先オブジェクトと
obj の間で呼び出せるメソッドに違いがあった場合は、
何かしらの例外が発生する可能性があります。
@param obj 委譲先のオブジェクト
@return 変更後の委譲先オブジェクト -
SimpleDelegator
. new(obj) -> object (42001.0) -
メソッドを委譲するオブジェクトの設定と、 メソッド委譲を行うためのクラスメソッドの定義を行います。
メソッドを委譲するオブジェクトの設定と、
メソッド委譲を行うためのクラスメソッドの定義を行います。
@param obj 委譲先のオブジェクト
@see Delegator.new -
WeakRef (36019.0)
-
weak reference を実現するクラスです。
weak reference を実現するクラスです。
WeakRef オブジェクトは与えられたオブジェクトをポイントしますが、
ポイント先のオブジェクトは GC される可能性があります。
アクセスしようとしたときにオブジェクトが GC されていれば
WeakRef::RefError が発生します。
delegate も参照してください。
=== サンプルコード
require 'weakref'
foo = Object.new
ref = WeakRef.new(foo)
ref.some_method_of_foo -
Ruby用語集 (19699.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
Ruby用語集
A B C D E F G I J M N O R S Y
a ka sa ta na ha ma ya ra wa
=== 記号・数字
: %記法
: % notation
「%」記号で始まる多種多様なリテラル記法の総称。
参照:d:spec/literal#percent
: 0 オリジン
: zero-based
番号が 0 から始まること。
例えば、
Array や Vector、Matrix などの要素の番号、
String における文字の位置、
といったものは 0 オリジンである。
: 1 オリジン
: one-based
... -
ruby 1
. 8 . 3 feature (18253.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
ruby 1.8.3 feature
*((<ruby 1.8 feature>))
*((<ruby 1.8.2 feature>))
ruby 1.8.2 から ruby 1.8.3 までの変更点です。
掲載方針
*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリへの単なる定数の追加は収録しない。
以下は各変更点に付けるべきタグです。
記号について(特に重要なものは大文字(主観))
* カテゴリ
* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ... -
WeakRef
# _ _ getobj _ _ -> object (18019.0) -
自身の参照先のオブジェクトを返します。
自身の参照先のオブジェクトを返します。
@raise WeakRef::RefError GC 済みのオブジェクトを参照した場合に発生します。
@see delegate -
Module
# ruby2 _ keywords(method _ name , . . . ) -> nil (1099.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... -
NEWS for Ruby 2
. 7 . 0 (1063.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...に注意してください。
* パターンマッチに対する警告は「-W:no-experimental」オプションで抑制できます。
==== 3.0 に向けてのキーワード引数の仕様変更
* キーワード引数と位置引数の自動変換は自動変換が非推奨となりま......ンで止められます。
//emlist{
def foo
class << Object.new
yield #=> warning: `yield' in class syntax will not be supported from Ruby 3.0. 15575
end
end
foo { p :ok }
//}
* 引数を転送する記法「(...)」が導入されました。 16253
* foo の全ての引数(キー......//emlist[][ruby]{
def foo(...)
bar(...)
end
//}
* 「$SAFE」の参照や代入は警告が表示されるようになりました。
Ruby 3.0 で「$SAFE」は普通のグローバル変数になる予定です。 16131
* Object#taint,Object#untaint,Object#trust,Object#untrustと関連... -
Proc
# ruby2 _ keywords -> proc (499.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 ...