るりまサーチ

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

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Exception#cause -> Exception | nil (18236.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

//}...

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

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソッドが例外オブ...
...r
ensure
p err #=> #<NameError: !!error!!>
end

//}

//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end


foo(4) #=> in method.in rescue.in method....

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

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソッドが例外オブ...
...r
ensure
p err #=> #<NameError: !!error!!>
end

//}

//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end


foo(4) #=> in method.in rescue.in method....

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

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...タックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクトを返さな...
..."in ensure.\n"
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 Ke...

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

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...タックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクトを返さな...
..."in ensure.\n"
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 Ke...

絞り込み条件を変える

Kernel.#fail(message, cause: $!) -> () (166.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソッドが例外オブ...
...r
ensure
p err #=> #<NameError: !!error!!>
end

//}

//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end


foo(4) #=> in method.in rescue.in method....

Kernel.#raise(message, cause: $!) -> () (166.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソッドが例外オブ...
...r
ensure
p err #=> #<NameError: !!error!!>
end

//}

//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end


foo(4) #=> in method.in rescue.in method....

Kernel.#fail(message, cause: $!) -> () (160.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...タックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクトを返さな...
..."in ensure.\n"
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 Ke...

Kernel.#raise(message, cause: $!) -> () (160.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...タックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクトを返さな...
..."in ensure.\n"
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 Ke...

NEWS for Ruby 3.0.0 (72.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...> a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end

//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]...
...d. 17221
* GC
* GC.auto_compact= and GC.auto_compact have been added to control when compaction runs. Setting `auto_compact=` to `true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, so please test first! 17...
...da's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#zero? for optimization. 16961
* Enumerable#grep and Enumerable#grep_v when...

絞り込み条件を変える

Kernel.#fail -> () (66.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソッドが例外オブ...
...r
ensure
p err #=> #<NameError: !!error!!>
end

//}

//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end


foo(4) #=> in method.in rescue.in method....

Kernel.#raise -> () (66.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソッドが例外オブ...
...r
ensure
p err #=> #<NameError: !!error!!>
end

//}

//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end


foo(4) #=> in method.in rescue.in method....

Kernel.#fail -> () (60.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...タックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクトを返さな...
..."in ensure.\n"
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 Ke...

Kernel.#raise -> () (60.0)

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

...させます。

//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end

//}

引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま...
...タックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
@raise TypeError exception メソッドが例外オブジェクトを返さな...
..."in ensure.\n"
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 Ke...

NEWS for Ruby 2.1.0 (42.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...数の虚部が有理数になる
42ri # => Complex(0, 42r)
3.14ri # => Complex(0, 3.14r)
//}

* def によるメソッド定義式は nil の代わりにメソッド名をシンボルで返します

=== 組み込みクラスの更新

* Array
* 追加: Array#to_h キーと値の...
...umerable
* 追加: Enumerable#to_h キーと値のペアのリストをハッシュに変換します。

* Exception
* 追加: Exception#cause 一つ前の例外を新しい例外を返します。
例外を rescue して raise しなおしたときに元の例外が一つ前の例...
...ence としてサポートしました??
* 拡張: IO#seek 第2引数としてシンボルを受け付けるようになりました (:CUR, :END, :SET, :DATA, :HOLE)
* 拡張: IO#read_nonblock シンボルを返すためにキーワード引数 `exception: false` を受け付けるよう...

絞り込み条件を変える

CSV.new(data, options = Hash.new) -> CSV (24.0)

このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。

...r" の並びまでを読みます。
A sequence will be selected even if it occurs in a quoted field, assuming that you
would have the same line endings there. If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only avail...
...peed is important. Also
note that IO objects should be opened in binary mode on Windows if this
feature will be used as the line-ending translation can cause
problems with resetting the document position to where it was before the
read ahead. This String will be transcoded into the data...
...faulty. You can use this limit to
prevent what are effectively DoS attacks on the parser. However, this
limit can cause a legitimate parse to fail and thus is set to +nil+, or off,
by default.
: :converters
CSV::Converters から取り出した名前の配列です。変換器が一つ...
<< 1 2 > >>