るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

検索結果

<< < 1 2 3 > >>

Thread#abort_on_exception=(newstate) (18339.0)

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

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

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

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

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

Exception#inspect -> String (15225.0)

self のクラス名と message を文字列にして返します。

...self のクラス名と message を文字列にして返します。

//emlist[例][ruby]{
begin
r
aise "exception"
r
escue
p $!.inspect # => "#<RuntimeError: exception>"
end
//}...

Exception#to_s -> String (15219.0)

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

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

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

Exception#to_json(*args) -> String (15213.0)

自身を JSON 形式の文字列に変換して返します。

...erator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

//emlist[例][ruby]{
r
equire "json/add/core"

begin
0/0
r
escue => e
e.to_json # => "{\"json_class\":\"ZeroDivisionError\...
...",\"m\":\"divided by 0\",\"b\":[\"/path/to/test.rb:4:in `/'\",\"/path/to/test.rb:4:in `<main>'\"]}"
end
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

Encoding::Converter#last_error -> Exception | nil (12314.0)

直前に変換器で発生した例外に相当する例外オブジェクトを返します。 直前の変換で例外が発生していない場合は nil を返します。

...す。

//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "iso-8859-1")
p ec.primitive_convert(src="\xf1abcd", dst="") #=> :invalid_byte_sequence
p ec.last_error #=> #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a" on UTF-8>
p ec.primitive_convert(src, dst, nil, 1)...
...#=> :destination_buffer_full
p ec.last_error #=> nil
//}...

絞り込み条件を変える

Net::HTTPExceptions#response -> Net::HTTPResponse (12313.0)

例外の原因となったレスポンスオブジェクトを返します。

...レスポンスオブジェクトを返します。

//emlist[例][ruby]{
r
equire 'net/http'

uri = "http://www.example.com/invalid.html"
r
esponse = Net::HTTP.get_response(URI.parse(uri))
begin
r
esponse.value
r
escue => e
e.response # => #<Net::HTTPNotFound 404 Not Found readbody=true>
end
//}...

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

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

...列を返します。

返される文字列は Ruby が捕捉されなかった例外を標準エラー出力に出力するときと
同じ形式です。
そのため、メソッド呼び出し時に $stderr が変更されておらず、$stderr.tty? が真の場合は
エスケープシーケン...
...highlight と order は 2.5.1 で追加されました。

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

@param order :top か :bottom で指...
...ジの上(top)か下(bottom)かを指定します。
デフォルト値は Exception.to_tty? が真なら :bottom で偽なら :top です。

//emlist[例][ruby]{
begin
r
aise "test"
r
escue => e
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<mai...
...装飾がついています。


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

@param order :top か :bottom で指定する必要がありま...

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

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

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

@param other 自身と比較したいオブジェクトを指定します。...
...た場合は
Exception
#exception を実行して変換を試みます。

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

def get_exception
r
eturn begin
yield
r
escue => e...
...end
end

r
esults = [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 が...

Exception#message -> String (12219.0)

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

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

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

Kernel#timeout(sec, exception_class = nil) {|i| .... } -> object (9350.0)

ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。

...の期限付きで実行します。
ブロックの実行時間が制限を過ぎたときは例外
T
imeout::Error が発生します。

exception
_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいり...
...@param sec タイムアウトする時間を秒数で指定します.
@param exception_class タイムアウトした時、発生させる例外を指定します.

=== 注意

t
imeout による割り込みは Thread によって実現されています。C 言語
レベルで実装され、Ruby...
...対して
t
imeout は無力です。
そのような
ものは実用レベルでは少ないのですが、例をあげると Socket などは
DNSの名前解決に時間がかかった場合割り込めません
(resolv-replace を使用する必要があります)。
その処理を Ruby で実装...

絞り込み条件を変える

<< < 1 2 3 > >>