るりまサーチ

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.007秒)
トップページ > クエリ:Fail[x] > 種類:ライブラリ[x]

別のキーワード

  1. kernel fail
  2. _builtin fail
  3. socket eai_fail
  4. constants eai_fail
  5. ssl verify_fail_if_no_peer_cert

検索結果

e2mmap (25.0)

例外クラスに特定のエラーメッセージ用フォーマットを関連づけるためのライブラリです。

...ssage ExistingExceptionClass, "message..."
def_exception :NewExceptionClass, "message...", StandardError
...
end

foo = Foo.new
foo.Fail ....

2. 何度も使いたい例外クラスは、クラスの代わりにモジュールで定義して、
それを include して使います...
...def_exception :NewExceptionClass, "message...", StandardError
...
end
class Foo
include ErrorMod
...
end

foo = Foo.new
foo.Fail ....

3. 例外を設定したクラスのインスタンス以外から例外を呼ぶこともできます。

例:

module ErrorMod
extend...
...def_e2message ExistingExceptionClass, "message..."
def_exception :NewExceptionClass, "message...", StandardError
...
end
class Foo
extend Exception2MessageMapper
include ErrorMod
...
end

Foo.Fail NewExceptionClass, arg...
Foo.Fail ExistingExceptionClass, arg......