種類
- モジュール関数 (96)
- インスタンスメソッド (28)
- 特異メソッド (24)
- 文書 (22)
ライブラリ
- ビルトイン (134)
- bigdecimal (2)
- e2mmap (12)
クラス
- BigDecimal (2)
-
Encoding
:: Converter (11) - Exception (22)
- Fiber (5)
モジュール
- Exception2MessageMapper (12)
- Kernel (96)
検索結果
先頭5件
-
Exception
. exception(error _ message = nil) -> Exception (36648.0) -
例外オブジェクトを生成して返します。
...属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some message")
p e # => #<Exception: some message>
p e.message # => "some message"
//}
//emlist[例][ruby]{
e = Exception.exception("some mes......sage")
p e # => #<Exception: some message>
p e.message # => "some message"
//}... -
Exception
. new(error _ message = nil) -> Exception (33548.0) -
例外オブジェクトを生成して返します。
...属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some message")
p e # => #<Exception: some message>
p e.message # => "some message"
//}
//emlist[例][ruby]{
e = Exception.exception("some mes......sage")
p e # => #<Exception: some message>
p e.message # => "some message"
//}... -
BigDecimal
. new(s , exception: true) -> BigDecimal | nil (24606.0) -
このメソッドは Ruby 2.5 から deprecated です。Kernel.#BigDecimal を使用してください。
...このメソッドは Ruby 2.5 から deprecated です。Kernel.#BigDecimal を使用してください。
新しい BigDecimal オブジェクトを生成します。
詳しくは Kernel.#BigDecimal を参照してください。... -
BigDecimal
. new(s , n , exception: true) -> BigDecimal | nil (24606.0) -
このメソッドは Ruby 2.5 から deprecated です。Kernel.#BigDecimal を使用してください。
...このメソッドは Ruby 2.5 から deprecated です。Kernel.#BigDecimal を使用してください。
新しい BigDecimal オブジェクトを生成します。
詳しくは Kernel.#BigDecimal を参照してください。... -
Exception2MessageMapper
# Fail(exception _ class = nil , *rest) -> () (15534.0) -
登録されている情報を使用して、例外を発生させます。
...param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない場合に発生します。
例:
class Foo
extend Exception2Mess......f_exception :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。
Foo.Raise Foo::NewEx......ceptionClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Kernel
. # Rational(x , y = 1 , exception: true) -> Rational | nil (12632.0) -
引数を有理数(Rational)に変換した結果を返します。
...有理数(Rational)に変換した結果を返します。
@param x 変換対象のオブジェクトです。
@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。
@param exception false を指定...... nil を返します。
@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。
引数 x、y の両方を指定した場合、x/y した Rational オブジェクトを
返します。
//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1,......ional('1_234_567') # => (1234567/1)
Rational(" \n10\t ") # => (10/1) # 空白類は無視される
Rational("0x10") # => ArgumentError
//}
引数に変換できないオブジェクトを指定した場合には ArgumentError が
発生します。
//emlist[例][ruby]{
Rational(Object.new... -
Kernel
. # fail(error _ type , message = nil , backtrace = caller(0) , cause: $ !) -> () (12462.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...RuntimeError を発生させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro......て例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。
@param error_type 発......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.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)......、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソ... -
Exception2MessageMapper
# Raise(exception _ class = nil , *rest) -> () (12434.0) -
登録されている情報を使用して、例外を発生させます。
...param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない場合に発生します。
例:
class Foo
extend Exception2Mess......f_exception :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。
Foo.Raise Foo::NewEx......ceptionClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Kernel
. # fail -> () (12262.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...RuntimeError を発生させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro......て例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。
@param error_type 発......、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソ... -
Kernel
. # fail(message , cause: $ !) -> () (12262.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...RuntimeError を発生させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro......て例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。
@param error_type 発......、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソ... -
Kernel
. # fail -> () (12250.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...RuntimeError を発生させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro......て例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。
@param error_type 発......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.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)... -
Kernel
. # fail(message , cause: $ !) -> () (12250.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...RuntimeError を発生させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro......て例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。
@param error_type 発......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.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)... -
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (9562.0) -
引数を整数 (Fixnum,Bignum) に変換した結果を返します。
...引数を整数
(Fixnum,Bignum)
に変換した結果を返します。
引数が数値の場合は直接変換し(小数点以下切り落とし)、
文字列の場合は、進数を表す接頭辞を含む整数表現とみなせる文字列のみ
変換します。
数値と文字列以外......ram exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i......ise TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into I......辞を含む整数表現とみなせる文字列のみ
変換します。
数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。
@param arg 変換対象のオブジェクトです。
@param base 基数として0か2から36... -
Encoding
:: Converter # last _ error -> Exception | nil (9436.0) -
直前に変換器で発生した例外に相当する例外オブジェクトを返します。 直前の変換で例外が発生していない場合は nil を返します。
...場合は 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_conve......rt(src, dst, nil, 1) #=> :destination_buffer_full
p ec.last_error #=> nil
//}... -
Kernel
. # raise(error _ type , message = nil , backtrace = caller(0) , cause: $ !) -> () (9362.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...RuntimeError を発生させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeErro......て例外ではないクラスやオブジェクトを指定した場合、
そのオブジェクトの exception メソッドが返す値を発生する例外にします。
その際、exception メソッドに引数として変数 message を渡すことができます。
@param error_type 発......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.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)......、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に設定する例外を指定します。
Exception オブジェクトまたは nil を指定できます。
@raise TypeError exception メソ...