るりまサーチ

最速Rubyリファレンスマニュアル検索!
364件ヒット [301-364件を表示] (0.053秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

検索結果

<< < ... 2 3 4 >>

TracePoint#eval_script -> String | nil (11006.0)

script_compiledイベント発生時にコンパイルされたソースコードを返します。 ファイルから読み込んだ場合は、nilを返します。

...パイルされたソースコードを返します。
ファイルから読み込んだ場合は、nilを返します。

//emlist[例][ruby]{
Trace
Point.new(:script_compiled) do |tp|
p tp.eval_script # => "puts 'hello'"
end.enable do
eval("puts 'hello'")
end
//}

@raise RuntimeError :script_co...

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

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

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

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

TracePoint#parameters -> [object] (11006.0)

現在のフックが属するメソッドまたはブロックのパラメータ定義を返します。 フォーマットは Method#parameters と同じです。

...イベントのためのイベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(a, b = 2)
end
Trace
Point.new(:call) do |tp|
p tp.parameters # => a], [:opt, :b
end.enable do
foo(1)
end
//}

@see Method#parameters, UnboundMethod#parameters, Proc#pa...

Fiber#raise(exception, message = nil, backtrace = nil) -> object (8112.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...なる文字列です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}

//emlist[...

Kernel.#fail(error_type, message = nil, backtrace = caller(0), cause: $!) -> () (8112.0)

例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。

...スまたは例外クラスのインスタンスで指定します。
@param message 例外のメッセージとなる文字列です。
@param backtrace 例外発生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cau...
...end

foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}

//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end

begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}

@see Kernel.#caller...

絞り込み条件を変える

Kernel.#raise(error_type, message = nil, backtrace = caller(0), cause: $!) -> () (8112.0)

例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。

...スまたは例外クラスのインスタンスで指定します。
@param message 例外のメッセージとなる文字列です。
@param backtrace 例外発生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cau...
...end

foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}

//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end

begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}

@see Kernel.#caller...

Thread#raise(error_type, message, traceback) -> () (8106.0)

自身が表すスレッドで強制的に例外を発生させます。

...pe Kernel.#raise を参照してください。

@param message Kernel.#raise を参照してください。

@param traceback Kernel.#raise を参照してください。

Thread.new {
sleep 1
Thread.main.raise "foobar"
}

begin
sleep
rescue
p $!, $@
end

=> #<RuntimeErr...

RubyVM::InstructionSequence.compile_option=(options) (8018.0)

命令シーケンスのコンパイル時のデフォルトの最適化オプションを引数 options で指定します。

...mization
* :specialized_instruction
* :stack_caching
* :tailcall_optimization
* :trace_instruction
//}
:debug_level をキーに指定した場合は値を数値で指定します。

.new、.compile、.compile_file メソッドの実行の際に option 引数を指定し
...
...場合はその実行のみ最適化オプションを変更する事もできます。

@see RubyVM::InstructionSequence.new,
RubyVM::InstructionSequence.compile,
RubyVM::InstructionSequence.compile_file...
<< < ... 2 3 4 >>