48件ヒット
[1-48件を表示]
(0.023秒)
種類
- インスタンスメソッド (36)
- 文書 (12)
ライブラリ
- ビルトイン (36)
クラス
- BasicObject (12)
- Module (24)
キーワード
-
class
_ exec (12) -
instance
_ exec (12) -
ruby 1
. 9 feature (12)
検索結果
先頭4件
-
Module
# module _ exec(*args) {|*vars| . . . } -> object (15119.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"
p... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (19.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"
p... -
BasicObject
# instance _ exec(*args) {|*vars| . . . } -> object (18.0) -
与えられたブロックをレシーバのコンテキストで実行します。
...タに渡す値です。
//emlist[例][ruby]{
class KlassWithSecret
def initialize
@secret = 99
end
end
k = KlassWithSecret.new
# 以下で x には 5 が渡される
k.instance_exec(5) {|x| @secret + x } #=> 104
//}
@see Module#class_exec, Module#module_exec, BasicObject#instance_eval... -
ruby 1
. 9 feature (18.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...identity?
=== 2006-09-11
: Hash#identical
: Hash#identical?
=== 2006-08-31
: Array#shuffle
: Array#shuffle!
追加
=== 2006-07-26
: __send
: __send!
追加
: invoke_method
: invoke_functional_method
削除
=== 2006-07-21
: Module#attr
オプショナル引数の assignable が......solete]
: scan [obsolete]
削除
=== 2005-10-21
: funcall [new]
fcall から改名
: Module#instance_exec [new]
: Module#module_exec [new]
追加
=== 2005-09-16
: ((<Dir/Dir.glob>)) [compat]
: ((<Dir/Dir.[]>)) [compat]
Dir.glob に配列を渡して複数のパタ......0b*") # => ["foo", "bar"]
p Dir.glob("{f*,b*}") # => ["foo", "bar"]
=== 2005-09-05
: fcall [new]
追加
=== 2005-08-30
: Object#send, Object#__send__ [ruby][change]
レシーバを指定した呼び出しではprivateメソッドを呼び出せなくなりました。
=== 2005-06-09
:...