7件ヒット
[1-7件を表示]
(0.114秒)
種類
- インスタンスメソッド (5)
- クラス (2)
ライブラリ
- ビルトイン (7)
クラス
- Integer (2)
- Rational (2)
- TracePoint (1)
キーワード
-
/ (2) - TracePoint (1)
- div (1)
- quo (1)
-
raised
_ exception (1)
検索結果
先頭5件
-
ZeroDivisionError (156001.0)
-
整数に対して整数の 0 で除算を行ったときに発生します。
整数に対して整数の 0 で除算を行ったときに発生します。 -
Integer
# div(other) -> Integer (42337.0) -
整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
整商(整数の商)を返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Integer オブジェクトの場合、Integer#/ の結果と一致します。
div に対応する剰余メソッドは modulo です。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7.div(2) # => 3
7.div(-2) # => -4
7.div(2.0) # => 3
7.div(Rational(2, 1)) # => 3
begin
2.div(0)
rescue => ... -
TracePoint
# raised _ exception -> Exception (42319.0) -
発生した例外を返します。
発生した例外を返します。
@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace.enable
begin
0/0
rescue
end
//} -
TracePoint (42019.0)
-
Kernel.#set_trace_func と同様の機能をオブジェクト指向的な API で 提供するクラスです。
Kernel.#set_trace_func と同様の機能をオブジェクト指向的な API で
提供するクラスです。
//emlist[例:例外に関する情報を収集する][ruby]{
trace = TracePoint.new(:raise) do |tp|
p [tp.lineno, tp.event, tp.raised_exception]
end
# => #<TracePoint:0x007f786a452448>
trace.enable
# => false
0 / 0
# => [5, :raise, #<ZeroDivisionError: divided by 0... -
Integer
# / (other) -> Numeric (33337.0) -
除算の算術演算子。
除算の算術演算子。
other が Integer の場合、整商(整数の商)を Integer で返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Float、Rational、Complex の場合、普通の商を other と
同じクラスのインスタンスで返します。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7 / 2 # => 3
7 / -2 # => -4
7 / 2.0 # => 3.5
7 / Rational(2, 1) # => (7/2)
7... -
Rational
# / (other) -> Rational | Float (33337.0) -
商を計算します。
商を計算します。
@param other 自身を割る数
other に Float を指定した場合は、計算結果を Float で返します。
//emlist[例][ruby]{
r = Rational(3, 4)
r / 2 # => (3/8)
r / 2.0 # => 0.375
r / 0.5 # => 1.5
r / Rational(1, 2) # => (3/2)
r / 0 # => ZeroDivisionError
//}
@raise ZeroD... -
Rational
# quo(other) -> Rational | Float (33337.0) -
商を計算します。
商を計算します。
@param other 自身を割る数
other に Float を指定した場合は、計算結果を Float で返します。
//emlist[例][ruby]{
r = Rational(3, 4)
r / 2 # => (3/8)
r / 2.0 # => 0.375
r / 0.5 # => 1.5
r / Rational(1, 2) # => (3/2)
r / 0 # => ZeroDivisionError
//}
@raise ZeroD...