ライブラリ
- ビルトイン (205)
- getoptlong (33)
- logger (1)
- mkmf (22)
- openssl (11)
- pp (11)
- rake (33)
-
rake
/ packagetask (11) -
rdoc
/ markup (11) -
rubygems
/ command (11) -
rubygems
/ command _ manager (11) -
rubygems
/ indexer (11) - win32ole (11)
クラス
- BasicObject (22)
- Exception (40)
- Fiber (15)
-
Gem
:: Command (11) -
Gem
:: CommandManager (11) -
Gem
:: Indexer (11) - GetoptLong (33)
- Hash (11)
-
Logger
:: Application (1) - Object (11)
-
OpenSSL
:: SSL :: SSLContext (11) -
RDoc
:: Markup (11) -
Rake
:: InvocationChain (11) -
Rake
:: PackageTask (11) - Thread (11)
- TracePoint (95)
- WIN32OLE (11)
モジュール
- Enumerable (11)
- Kernel (22)
-
Rake
:: TaskManager (22)
キーワード
- == (11)
-
add
_ word _ pair (11) - append (11)
-
callee
_ id (11) - cause (11)
- chunk (11)
- define (11)
-
enhance
_ with _ matching _ rule (11) -
eval
_ script (6) - event (11)
- execute (11)
-
find
_ command (11) - inspect (11)
-
instance
_ eval (22) -
instruction
_ sequence (6) - lineno (11)
-
method
_ id (11) -
method
_ missing (11) - ordering= (11)
- parameters (6)
- paranoid (11)
- path (11)
-
pretty
_ print _ inspect (11) -
raised
_ exception (11) - rehash (11)
-
renegotiation
_ cb= (11) -
return
_ value (11) - start (1)
-
synthesize
_ file _ task (11) - terminate (11)
-
try
_ do (22)
検索結果
先頭5件
-
Fiber
# raise -> object (18134.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...している場合、
FiberError が発生します。
引数を渡さない場合、RuntimeError が発生します。
message 引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exc......ew { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Fiber
# raise(exception , message = nil , backtrace = nil) -> object (18134.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...している場合、
FiberError が発生します。
引数を渡さない場合、RuntimeError が発生します。
message 引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exc......ew { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Fiber
# raise(message) -> object (18134.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...している場合、
FiberError が発生します。
引数を渡さない場合、RuntimeError が発生します。
message 引数を渡した場合、message 引数をメッセージとした RuntimeError
が発生します。
その他のケースでは、最初の引数は Exception か Exc......ew { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Thread
# raise(error _ type , message , traceback) -> () (18132.0) -
自身が表すスレッドで強制的に例外を発生させます。
...nel.#raise を参照してください。
@param message Kernel.#raise を参照してください。
@param traceback Kernel.#raise を参照してください。
Thread.new {
sleep 1
Thread.main.raise "foobar"
}
begin
sleep
rescue
p $!, $@
end
=> #<RuntimeError: fo... -
TracePoint
# raised _ exception -> Exception (6125.0) -
発生した例外を返します。
...発生した例外を返します。
@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided... -
BasicObject
# instance _ eval {|obj| . . . } -> object (31.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...a } #=> "secret" # private メソッドも呼び出せる
some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999: unknown (RuntimeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_e......val("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
BasicObject
# instance _ eval(expr , filename = "(eval)" , lineno = 1) -> object (31.0) -
オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。
...a } #=> "secret" # private メソッドも呼び出せる
some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999: unknown (RuntimeError)
//}
//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_e......val("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end
bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}
@see Module#module_eval, Kernel.#eval, BasicObject#instance_exec... -
Exception
# ==(other) -> bool (25.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...nth, -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 {... -
Exception
# cause -> Exception | nil (25.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
//}... -
Enumerable
# chunk {|elt| . . . } -> Enumerator (19.0) -
要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。
...で始まるシンボルを指定した場合は例外が発生します。
//emlist[例][ruby]{
[1, 2].chunk { |item| :_underscore }.to_a
# => RuntimeError: symbols beginning with an underscore are reserved
# 「.to_a」無しだと Enumerator を返すのみで例外は発生しない
//}
nil......A[A-Z][A-Za-z0-9_]+\#/
open(filename) {|f|
f.chunk {|line| pat =~ line ? $& : :_alone }.each {|key, lines|
if key != :_alone
print lines.sort.join('')
else
print lines.join('')
end
}
}
//}
@raise RuntimeError 予約されている値を用いた場合に発生します... -
GetoptLong
# ordering=(ordering) (19.0) -
順序形式を設定します。
...:RETURN_IN_ORDER のいずれかを指定します。
@raise ArgumentError GetoptLong::REQUIRE_ORDER, GetoptLong::PERMUTE,
GetoptLong::RETURN_IN_ORDER 以外の値を指定した場合に発生します。
@raise RuntimeError GetoptLong#get, GetoptLong#get_option,...