るりまサーチ

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

別のキーワード

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

検索結果

<< < 1 2 3 >>

ObjectSpace.#define_finalizer(obj) {|id| ...} -> Array (8008.0)

obj が解放されるときに実行されるファイナライザ proc を 登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで はなく追加登録されます。固定値 0 と proc を配列にして返します。

...いでしょう。

//emlist[例][ruby]{
class Baz
def initialize
ObjectSpace.define_finalizer self, eval(%q{
proc {
raise "baz" rescue puts $!
raise "baz2"
puts "baz3"
}
}, TOPLEVEL_BINDING)
end
end
Baz.new
GC.start

# => baz
//}

@see spec/rubycmd...

ObjectSpace.#define_finalizer(obj, proc) -> Array (8008.0)

obj が解放されるときに実行されるファイナライザ proc を 登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで はなく追加登録されます。固定値 0 と proc を配列にして返します。

...いでしょう。

//emlist[例][ruby]{
class Baz
def initialize
ObjectSpace.define_finalizer self, eval(%q{
proc {
raise "baz" rescue puts $!
raise "baz2"
puts "baz3"
}
}, TOPLEVEL_BINDING)
end
end
Baz.new
GC.start

# => baz
//}

@see spec/rubycmd...

RubyVM::InstructionSequence.of(body) -> RubyVM::InstructionSequence (8008.0)

引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。

...実行した場合

# proc
> p = proc { num = 1 + 2 }
> RubyVM::InstructionSequence.of(p)
> # => <RubyVM::InstructionSequence:block in irb_binding@(irb)>

# method
> def foo(bar); puts bar; end
> RubyVM::InstructionSequence.of(method(:foo))
> # => <RubyVM::InstructionSequence:foo@(ir...

Thread#backtrace -> [String] | nil (8008.0)

スレッドの現在のバックトレースを返します。

...def m1
sleep 5
end
def m2
m1
end
end

th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] "(irb):10:in `block in irb_binding'"
# ]

th.kill
th.backtrace # => nil
//}...

Thread#report_on_exception -> bool (8008.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...8c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run #...

絞り込み条件を変える

Thread#report_on_exception=(newstate) (8008.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...8c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_exception = false
b.run #...
<< < 1 2 3 >>