390件ヒット
[201-300件を表示]
(0.086秒)
別のキーワード
クラス
- BasicObject (48)
- Binding (70)
- Module (96)
- Object (78)
- Proc (24)
-
RubyVM
:: InstructionSequence (24) - String (12)
- TracePoint (26)
-
WIN32OLE
_ TYPE (12)
キーワード
- binding (12)
-
class
_ eval (24) -
class
_ exec (12) -
default
_ event _ sources (12) -
define
_ method (24) - dump (12)
-
eval
_ script (7) -
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ variables (12) -
instruction
_ sequence (7) -
local
_ variable _ defined? (12) -
local
_ variable _ get (12) -
local
_ variable _ set (12) -
local
_ variables (11) - method (12)
-
module
_ eval (24) -
module
_ exec (12) - receiver (11)
-
respond
_ to? (12) - self (12)
- send (24)
-
singleton
_ method (12) -
singleton
_ method _ undefined (12) -
source
_ location (12) - taint (6)
-
to
_ a (12)
検索結果
先頭5件
-
String
# dump -> String (23.0) -
文字列中の非表示文字をバックスラッシュ記法に置き換えた文字列を返します。 str == eval(str.dump) となることが保証されています。
...列中の非表示文字をバックスラッシュ記法に置き換えた文字列を返します。
str == eval(str.dump) となることが保証されています。
//emlist[例][ruby]{
# p だとさらにバックスラッシュが増えて見にくいので puts している
puts "abc\r\n\f... -
Binding
# local _ variable _ defined?(symbol) -> bool (19.0) -
引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。
...トで指定します。
//emlist[例][ruby]{
def foo
a = 1
binding.local_variable_defined?(:a) # => true
binding.local_variable_defined?(:b) # => false
end
//}
このメソッドは以下のコードの短縮形です。
//emlist[][ruby]{
binding.eval("defined?(#{symbol}) == 'local-variabl... -
Binding
# local _ variable _ get(symbol) -> object (19.0) -
引数 symbol で指定した名前のローカル変数に設定された値を返します。
...場合に発生します。
//emlist[例][ruby]{
def foo
a = 1
binding.local_variable_get(:a) # => 1
binding.local_variable_get(:b) # => NameError
end
//}
このメソッドは以下のコードの短縮形です。
//emlist[][ruby]{
binding.eval("#{symbol}")
//}
@see Binding#local_variabl... -
Binding
# local _ variables -> [Symbol] (19.0) -
ローカル変数の一覧を Symbol の配列で返します。
...カル変数の一覧を Symbol の配列で返します。
//emlist[例][ruby]{
def foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
//}
このメソッドは以下のコードと同様の動作をします。
//emlist[][ruby]{
binding.eval("local_variables")
//}... -
Module
# class _ exec(*args) {|*vars| . . . } -> object (19.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...スコープはブロックの外側のスコープになります。
@param 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 t.foo() #=> 1
//}
@see Module#module_eval, Module#class_eval... -
Module
# module _ exec(*args) {|*vars| . . . } -> object (19.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...スコープはブロックの外側のスコープになります。
@param 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 t.foo() #=> 1
//}
@see Module#module_eval, Module#class_eval... -
BasicObject
# instance _ exec(*args) {|*vars| . . . } -> object (13.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... -
BasicObject
# singleton _ method _ undefined(name) -> object (13.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...l で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Foo.new
def obj.foo
end
def obj.bar
end
class << obj
undef_method :foo
end
obj.instance_eval {undef bar}
#=> singleton method "foo... -
Binding
# receiver -> object (13.0) -
保持するコンテキスト内での self を返します。
...保持するコンテキスト内での self を返します。
このメソッドは以下のコードと同様の動作をします。
//emlist[][ruby]{
binding.eval("self")
//}...