るりまサーチ

最速Rubyリファレンスマニュアル検索!
113件ヒット [1-100件を表示] (0.048秒)
トップページ > クエリ:ins[x] > クエリ:eval[x]

別のキーワード

  1. streamui ins
  2. rubygems/user_interaction ins
  3. ins
  4. ins_methods_i
  5. ins gem::streamui

検索結果

<< 1 2 > >>

RubyVM::InstructionSequence#eval -> object (21107.0)

self の命令シーケンスを評価してその結果を返します。

...self の命令シーケンスを評価してその結果を返します。

RubyVM::InstructionSequence.compile("1 + 2").eval # => 3...

BasicObject#instance_eval(expr, filename = "(eval)", lineno = 1) -> object (12381.0)

オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。

... instance_eval の外側のスコープと、ブロックの評価ではそのブロックの外側のスコープと、共有します。

メソッド定義の中で instance_eval でメソッドを定義した場合は、囲むメソッドが実行されたときに
初めて instance_eval...
...定義のネストと同じです。
d:spec/def#nest_method を参照してください。

BasicObject を継承して作ったクラス内で instance_eval する場合はトップレベルの定数や Kernel モジュールに定義されているメソッドは見えません。
これは、ト...
...cret'
end
end

some = Foo.new 'XXX'
some.instance_eval{p @key} #=> "XXX"
some.instance_eval{do_fuga } #=> "secret" # private メソッドも呼び出せる

some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999:...

BasicObject#instance_eval {|obj| ... } -> object (12281.0)

オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。

... instance_eval の外側のスコープと、ブロックの評価ではそのブロックの外側のスコープと、共有します。

メソッド定義の中で instance_eval でメソッドを定義した場合は、囲むメソッドが実行されたときに
初めて instance_eval...
...定義のネストと同じです。
d:spec/def#nest_method を参照してください。

BasicObject を継承して作ったクラス内で instance_eval する場合はトップレベルの定数や Kernel モジュールに定義されているメソッドは見えません。
これは、ト...
...cret'
end
end

some = Foo.new 'XXX'
some.instance_eval{p @key} #=> "XXX"
some.instance_eval{do_fuga } #=> "secret" # private メソッドも呼び出せる

some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999:...

VALUE rb_obj_instance_eval(int argc, VALUE *argv, VALUE self) (12200.0)

TracePoint#instruction_sequence -> RubyVM::InstructionSequence (6212.0)

script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。

...にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。

//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval
("puts 'hello'")
end
//}

@raise Runt...

絞り込み条件を変える

BasicObject#instance_exec(*args) {|*vars| ... } -> object (6106.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...

IRB::ContextExtender.install_extend_commands -> object (6106.0)

定義済みの拡張を読み込みます。

...定義済みの拡張を読み込みます。

IRB::Context で以下のメソッドが利用できるようになります。

* eval_history=
* use_tracer=
* math_mode=
* use_loader=
* save_history=

irb/extend-command が require された時にライブラリ内部で自動的
に実行さ...

Object#instance_variables -> [Symbol] (6106.0)

オブジェクトのインスタンス変数名をシンボルの配列として返します。

...変数名をシンボルの配列として返します。

//emlist[][ruby]{
obj = Object.new
obj.instance_eval { @foo, @bar = nil }
p obj.instance_variables

#=> [:@foo, :@bar]
//}

@see Object#instance_variable_get, Kernel.#local_variables, Kernel.#global_variables, Module.constants, Module#consta...

RubyVM::InstructionSequence.load_from_binary(binary) -> RubyVM::InstructionSequence (3106.0)

RubyVM::InstructionSequence#to_binaryにより作られたバイナリフォーマットの文字列からiseqのオブジェクトをロードします。

...RubyVM::InstructionSequence#to_binaryにより作られたバイナリフォーマットの文字列からiseqのオブジェクトをロードします。

このローダーは検証機構をもっておらず、壊れたり改変されたバイナリを読み込むと深刻な問題を引き起...
...りません。自分が変換したバイナリデータを使うべきです。

//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary
RubyVM::InstructionSequence.load_from_binary(binary).eval # => 3
//}

@see RubyVM::InstructionSequence#to_binary...
<< 1 2 > >>