44件ヒット
[1-44件を表示]
(0.051秒)
種類
- インスタンスメソッド (33)
- 文書 (11)
ライブラリ
- ビルトイン (33)
クラス
- BasicObject (11)
- Module (22)
キーワード
-
class
_ exec (11) -
instance
_ exec (11) -
ruby 1
. 9 feature (11)
検索結果
先頭4件
-
Module
# module _ exec(*args) {|*vars| . . . } -> object (15201.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ローカル変数、定数とクラス変数のスコープはブロックの外側のスコープになります。
@param args ブロックに渡す引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
... -
ruby 1
. 9 feature (1914.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...w]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど(互換性のある変更) (only backward-compatibility) (影響の範囲が小さいと思われる変更もこちら)
* [change]: 変更されたクラス/メソッドなど(互換性......= 1.9.0
=== 2006-09-16
: Struct#inspect
=== 2006-09-14
: digest.rb
: Digest::Base.file
=== 2006-09-13
: Hash#compare_by_identity
: Hash#compare_by_identity?
: Hash#identical
: Hash#identical?
=== 2006-09-12
: Hash#compare_by_identity
: Hash#compare_by_identity?
=== 2006-09-11
: Hash#identi......obsolete]
: split [obsolete]
: 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 に配... -
BasicObject
# instance _ exec(*args) {|*vars| . . . } -> object (106.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... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (101.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
モジュールのコンテキストで評価するとは、実行中そのモジュールが self になるということです。
つまり、そのモジュールの定義式の中にあるかのように実行されます。
ローカル変数、定数とクラス変数のスコープはブロックの外側のスコープになります。
@param args ブロックに渡す引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
...