るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. kernel $-i
  5. ipaddr to_i

検索結果

<< < 1 2 3 > >>

Thread#abort_on_exception=(newstate) (12229.0)

真の場合、そのスレッドが例外によって終了した時に、インタプリタ 全体を中断させます。false の場合、あるスレッドで起こった例 外は、Thread#join などで検出されない限りそのスレッ ドだけをなにも警告を出さずに終了させます。

...の場合、あるスレッドで起こった例
外は、Thread#join などで検出されない限りそのスレッ
ドだけをなにも警告を出さずに終了させます。

デフォルトは偽です。c:Thread#exceptionを参照してください。

@param newstate 自身を実行中...
...に例外発生した場合、インタプリタ全体を終了させるかどうかを true か false で指定します。

//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.abort_on_exception # => false
thread.abort_on_exception = true
thread.abort_on_exception # => true
//}...

Exception#full_message(highlight: true, order: :bottom) -> String (12221.0)

例外の整形された文字列を返します。

...て実際に、キーワード引数 highlight と order は 2.5.1 で追加されました。

@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@...
...デフォルト値は Exception.to_tty? が真なら :bottom で偽なら :top です。

//emlist[例][ruby]{
begin
raise "test"
rescue => e
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
$s...
...tderr = $stdout
p e.full_message # => "test.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}

@see Exception.to_tty?...
...シーケンスによる文字装飾がついています。


@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@param order :top か :bottom で...

Exception#cause -> Exception | nil (12204.0)

self の前の例外(self が rescue 節や ensure 節の中で発生した例外の場合、 その前に発生していた元々の例外)を返します。存在しない場合は nil を返し ます。

...その前に発生していた元々の例外)を返します。存在しない場合は nil を返し
ます。

//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
p $! # => #<RuntimeError: outer>
p $!.cause # => #<RuntimeError: inner>
end
//}...

Exception#backtrace -> [String] (12109.0)

バックトレース情報を返します。

...rcefile}:#{sourceline}:in `#{method}'"
(メソッド内の場合)
* "#{sourcefile}:#{sourceline}"
(トップレベルの場合)

という形式の String の配列です。

//emlist[例][ruby]{
def methd
raise
end

begin
methd
rescue => e
p e.backtrace
end

#=> ["filename.rb:2:in `...
...methd'", "filename.rb:6"]
//}

@see Exception#backtrace_locations...

Exception#message -> String (12103.0)

エラーメッセージをあらわす文字列を返します。

...エラーメッセージをあらわす文字列を返します。

//emlist[例][ruby]{
begin
1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end
//}...

絞り込み条件を変える

Exception#to_s -> String (12103.0)

エラーメッセージをあらわす文字列を返します。

...エラーメッセージをあらわす文字列を返します。

//emlist[例][ruby]{
begin
1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end
//}...

SignalException#signm -> String (12103.0)

self.message のエイリアスです。

...self.message のエイリアスです。

//emlist[例][ruby]{
begin
Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
puts e.signm # => SIGHUP
end
//}...

SignalException#signo -> Integer (12103.0)

self のシグナル番号を返します。

...self のシグナル番号を返します。

//emlist[例][ruby]{
p Signal.signame(1) # => "HUP"
begin
Process.kill('HUP', Process.pid)
sleep
rescue SignalException => e
p e.signo # => 1
end
//}...

Exception#==(other) -> bool (12027.0)

自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。

...した場合は
Exception
#exception を実行して変換を試みます。

//emlist[例][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end

def get_exception
return begin
yield
rescue => e...
...e
end
end

results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]

# class, message, backtrace...

IO#write_nonblock(string, exception: true) -> Integer | :wait_writable (6410.0)

IO をノンブロッキングモードに設定し、string を write(2) システムコールで書き出します。

...
I
O をノンブロッキングモードに設定し、string を write(2) システムコールで書き出します。

write(2) が成功した場合、書き込んだ長さを返します。
EAGAIN, EINTR などは例外 Errno::EXXX として呼出元に報告されます。

書き込んだバ...
...返り値)は String#bytesize の
値より小さい可能性があります。

発生した例外 がErrno::EAGAIN、 Errno::EWOULDBLOCK である場合は、
その例外オブジェクトに IO::WaitWritable が Object#extend
されます。よって IO::WaitWritable を write_nonblock のリト...
...きます。

@param string 自身に書き込みたい文字列を指定します。

@param exception false を指定すると、書き込み時に Errno::EAGAIN、Errno::EWOULDBLOCK が発生
する代わりに :wait_writable を返します。

@raise IOError 自身が書き込...

絞り込み条件を変える

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

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

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

Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。

引数を渡さない場合、RuntimeError が発生します。
message...
...引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。

その他のケースでは、最初の引数は Exception Exception
のインスタンスを返す exception メソッドを持ったオブジェクトである
必要があります。
...
...です。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

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

//emlist[ファイバー...
<< < 1 2 3 > >>