211件ヒット
[201-211件を表示]
(0.110秒)
ライブラリ
- ビルトイン (162)
-
minitest
/ unit (1) - rake (12)
-
rubygems
/ config _ file (24) -
webrick
/ httpresponse (12)
クラス
- Exception (36)
- Fiber (6)
-
Gem
:: ConfigFile (24) -
Rake
:: Application (12) - Thread (36)
-
Thread
:: Backtrace :: Location (84) -
WEBrick
:: HTTPResponse (12)
モジュール
キーワード
- == (12)
-
absolute
_ path (12) - backtrace= (12)
-
backtrace
_ locations (36) -
base
_ label (12) - inspect (12)
- label (12)
- lineno (12)
- path (12)
- raise (6)
-
set
_ backtrace (12) -
set
_ error (12) - skip (1)
-
to
_ s (12)
検索結果
-
Exception
# ==(other) -> bool (129.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...自身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。......。
//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 が同一のため true になる
p results[0] == results[1] # => true
# class, b...