ライブラリ
- ビルトイン (1048)
- json (12)
-
json
/ add / exception (12) -
net
/ http (60) - openssl (12)
- optparse (24)
-
rubygems
/ command (12) - shell (18)
-
shell
/ command-processor (18) -
shell
/ filter (18) - socket (48)
- strscan (84)
- thread (12)
- win32ole (24)
- zlib (168)
クラス
- Array (72)
- BasicSocket (12)
-
Encoding
:: Converter (48) -
Encoding
:: InvalidByteSequenceError (24) -
Encoding
:: UndefinedConversionError (12) - Enumerator (12)
-
Enumerator
:: ArithmeticSequence (28) - Exception (140)
-
File
:: Stat (12) - FrozenError (6)
-
Gem
:: Command (12) - IO (12)
- Integer (23)
-
JSON
:: State (12) - KeyError (16)
- LoadError (12)
- LocalJumpError (12)
- MatchData (48)
- Module (12)
- Mutex (2)
- NameError (22)
-
Net
:: HTTPResponse (12) - NoMethodError (12)
- Object (12)
-
OpenSSL
:: SSL :: SSLContext (12) - OptionParser (24)
- Random (36)
- Range (72)
- Regexp (12)
- Shell (18)
-
Shell
:: CommandProcessor (18) -
Shell
:: Filter (18) - SignalException (24)
- Socket (12)
- StopIteration (12)
- String (144)
- StringScanner (84)
- SystemCallError (12)
- SystemExit (24)
- Thread (60)
-
Thread
:: Mutex (10) -
Thread
:: Queue (36) -
Thread
:: SizedQueue (36) - TracePoint (12)
- UDPSocket (12)
- UNIXServer (12)
- UncaughtThrowError (33)
- WIN32OLE (24)
-
Zlib
:: GzipReader (132) -
Zlib
:: GzipWriter (24) -
Zlib
:: Inflate (12)
モジュール
- Comparable (12)
-
Net
:: HTTPExceptions (12) -
Net
:: HTTPHeader (36)
キーワード
-
/ (11) - == (19)
- =~ (12)
- [] (126)
- accept (12)
-
accept
_ nonblock (12) - args (12)
- at (12)
- backtrace (12)
-
backtrace
_ locations (12) -
beginning
_ of _ line? (12) - begins? (12)
- bol? (12)
-
ca
_ file= (12) - cause (12)
-
check
_ circular? (12) - clamp (12)
- close (12)
-
connect
_ nonblock (12) - deq (24)
- div (12)
- each (12)
-
each
_ byte (24) -
each
_ line (12) - end (31)
- errno (12)
-
error
_ bytes (12) -
error
_ char (12) - exception (24)
- exit (12)
-
exit
_ value (12) - fetch (72)
- finish (12)
- first (24)
- getc (12)
- getpeereid (12)
- gets (12)
- hash (7)
-
incomplete
_ input? (12) -
initialize
_ copy (12) - inspect (12)
- key (8)
- kill (12)
- last (24)
- lineno (12)
- mkdir (18)
- next (12)
- offset (24)
-
ole
_ get _ methods (12) -
ole
_ query _ interface (12) - path (12)
- peek (12)
- peep (12)
- pointer= (12)
- pop (24)
- pos= (12)
-
primitive
_ convert (48) -
public
_ constant (12) - raise (12)
-
raised
_ exception (12) - rand (36)
- read (12)
- readbyte (12)
- readchar (12)
- readline (12)
- receiver (24)
-
recvfrom
_ nonblock (12) - reject (12)
- response (12)
- result (12)
-
set
_ backtrace (12) -
set
_ dictionary (12) - shift (24)
- signm (12)
- signo (12)
- slice (72)
- status (12)
- sticky? (12)
- success? (12)
- tag (11)
- terminate (12)
- test (18)
-
to
_ json (12) -
to
_ s (35) - ungetc (12)
- unlock (12)
- unscan (12)
- value (23)
検索結果
先頭5件
-
MatchData
# begin(n) -> Integer | nil (21238.0) -
n 番目の部分文字列先頭のオフセットを返します。
...範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.begin(0) # => 0
p $~.begin(1) # => 0
p $~.begin(2) # => 3
p $~.begin(3) # => nil
p $~.begin(4) # => `begin': index 4 out of matches (IndexError)
//}
@see MatchData#end... -
Enumerator
:: ArithmeticSequence # begin -> Numeric (21102.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Enumerator
:: ArithmeticSequence # begin -> Numeric | nil (21102.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Range
# begin -> object (18236.0) -
始端の要素を返します。 始端を持たない範囲オブジェクトの場合、begin はnilを返しますが, first は例外 RangeError が発生します。
...場合、begin はnilを返しますが, first は例外 RangeError が発生します。
//emlist[例][ruby]{
# 始端を持つ場合
p (1..5).begin # => 1
p (1..0).begin # => 1
p (1..5).first # => 1
p (1..0).first # => 1
# 始端を持たない場合
p (..5).begin #=> nil
p (..5).first #=> Range... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9207.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ption#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Dat......month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_ex......ception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Exception
# exception(error _ message) -> Exception (9207.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラーメッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# .........# 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
Thread
# terminate -> self (9207.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...す。
ただし、スレッドは終了処理中(aborting)にはなりますが、
直ちに終了するとは限りません。すでに終了している場合は何もしません。このメソッドにより
終了したスレッドの Thread#value の返り値は不定です。
自身がメ......exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
Encoding
:: InvalidByteSequenceError # incomplete _ input? -> bool (9113.0) -
エラー発生時に入力文字列が不足している場合に真を返します。
...//emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
ec.convert("abc\xA1z")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP>
p $!.incomplete_input? #=> false
end
begin
ec.convert("abc\......xA1")
ec.finish
rescue Encoding::InvalidByteSequenceError
p $! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP>
p $!.incomplete_input? #=> true
end
//}... -
Encoding
:: InvalidByteSequenceError # error _ bytes -> String (9107.0) -
エラー発生時に捨てられたバイト列を返します。
...//emlist[例][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
puts $!.error_bytes.dump #=> "\xA1"
puts $!.re......adagain_bytes.dump #=> "\xFF"
end
//}
@see Encoding::InvalidByteSequenceError#readagain_bytes... -
Exception
# exception -> self (9107.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラーメッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# .........# 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}...