93件ヒット
[1-93件を表示]
(0.030秒)
種類
- インスタンスメソッド (33)
- 文書 (27)
- クラス (22)
- 特異メソッド (11)
ライブラリ
- delegate (33)
- forwardable (22)
- weakref (11)
クラス
- SimpleDelegator (11)
モジュール
- Forwardable (22)
- Kernel (11)
キーワード
- DelegateClass (11)
-
NEWS for Ruby 2
. 7 . 0 (5) - Ruby用語集 (11)
- SimpleDelegator (11)
- WeakRef (11)
-
instance
_ delegate (11) -
ruby 1
. 8 . 3 feature (11)
検索結果
先頭5件
-
SimpleDelegator
. new(obj) -> object (26107.0) -
メソッドを委譲するオブジェクトの設定と、 メソッド委譲を行うためのクラスメソッドの定義を行います。
...メソッドを委譲するオブジェクトの設定と、
メソッド委譲を行うためのクラスメソッドの定義を行います。
@param obj 委譲先のオブジェクト
@see Delegator.new... -
NEWS for Ruby 2
. 7 . 0 (26054.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.7.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......name: "Alice", children: [{name: "Charlie", age: age}]}
#=> NoMatchingPatternError
//}
* 詳細は https://speakerdeck.com/k_tsj/pattern-matching-new-feature-in-ruby-2-dot-7 のスライドを参照してください。
* スライドは少し古い内容になっていることに注意して....../ruby/csv/blob/master/NEWS.md
* Date
* Date.jisx0301, Date#jisx0301, Date.parseが新しい日本の年号を
サポートしました。 15742
* Delegator
* Object#DelegateClassがブロックを受け付けるようになり、
Class.newやStruct.newのように返り値... -
ruby 1
. 8 . 3 feature (23384.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
...* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ライブラリ
* レベル
* [bug]: バグ修正
* [new]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど
* 互換性のある変更
* on......ry_secure [lib] [new]
: FileUtils.remove_entry [lib] [new]
: FileUtils.chmod_R [lib] [new]
: FileUtils.chown [lib] [new]
: FileUtils.chown_R [lib] [new]
: FileUtils.commands [lib] [new]
: FileUtils.options [lib] [new]
: FileUtils.ha.......rb
foo = Object.new
foo2 = SimpleDelegator.new(foo)
def foo.bar
puts "bar"
end
foo2.bar
$ ruby-1.8.2 -r delegate test_dlg.rb
test_dlg.rb:6: undefined method `bar' for #<Object:0x4021b0a0> (NoMethodError)
$ ruby-1.8.3 -r delegate test_dlg.rb
bar... -
Forwardable
# delegate(hash) -> () (18120.0) -
メソッドの委譲先を設定します。
...:
require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@str
delegate [:first, :last] => :@arr
def initialize
@arr = %w/foo bar baz/
@str = "world"
end
end
zap = Zap.new
zap.length # => 5
zap.first # => "foo"
zap.last # =>... -
Kernel
# DelegateClass(superclass) -> object (14112.0) -
クラス 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]
//}... -
SimpleDelegator (8018.0)
-
Delegator クラスを継承し、シンプルなメソッド委譲を実現した具象クラス。
...し、シンプルなメソッド委譲を実現した具象クラス。
委譲先に指定されたオブジェクトへメソッドの実行を委譲します。
例:
//emlist{
require 'delegate'
foo = Object.new
def foo.test
p 25
end
foo2 = SimpleDelegator.new(foo)
foo2.test # => 25
//}... -
Forwardable
# instance _ delegate(hash) -> () (6120.0) -
メソッドの委譲先を設定します。
...:
require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@str
delegate [:first, :last] => :@arr
def initialize
@arr = %w/foo bar baz/
@str = "world"
end
end
zap = Zap.new
zap.length # => 5
zap.first # => "foo"
zap.last # =>... -
WeakRef (18.0)
-
weak reference を実現するクラスです。
...あります。
アクセスしようとしたときにオブジェクトが GC されていれば
WeakRef::RefError が発生します。
delegate も参照してください。
=== サンプルコード
require 'weakref'
foo = Object.new
ref = WeakRef.new(foo)
ref.some_method_of_foo... -
Ruby用語集 (12.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...ッシュに呼び出しを丸投げすることで実装が簡素化できる。
標準添付ライブラリーには、委譲を支援する delegate や
forwardable がある。
: イテレーター
: iterator
一般には繰り返し(反復)を抽象化する仕組み全般を指す......文字としては特別扱いされない。
ただしパス名には使えず、ヌル文字を含んだ文字列を File.open や
Pathname.new に与えると ArgumentError が発生する。
他の言語では文字列の終端を意味することがあるので、文字列データ...