ライブラリ
- ビルトイン (796)
-
json
/ add / exception (12) -
net
/ http (48) - openssl (12)
- optparse (24)
-
rubygems
/ command (12) - shell (18)
-
shell
/ command-processor (18) -
shell
/ filter (18) - socket (36)
- strscan (60)
- thread (12)
- win32ole (24)
- zlib (144)
クラス
- Array (72)
-
Encoding
:: Converter (48) -
Encoding
:: InvalidByteSequenceError (12) - Enumerator (12)
-
Enumerator
:: ArithmeticSequence (21) - Exception (92)
- FrozenError (6)
-
Gem
:: Command (12) - IO (12)
- Integer (23)
- KeyError (16)
- MatchData (50)
- Module (12)
- Mutex (2)
-
Net
:: HTTPResponse (12) - Object (12)
-
OpenSSL
:: SSL :: SSLContext (12) - OptionParser (24)
- Random (36)
- Range (72)
- Regexp (12)
- Shell (18)
-
Shell
:: CommandProcessor (18) -
Shell
:: Filter (18) - Socket (12)
- String (144)
- StringScanner (60)
- Thread (60)
-
Thread
:: Mutex (10) -
Thread
:: Queue (36) -
Thread
:: SizedQueue (36) - TracePoint (12)
- UDPSocket (12)
- UNIXServer (12)
- WIN32OLE (24)
-
Zlib
:: GzipReader (132) -
Zlib
:: Inflate (12)
モジュール
- Comparable (12)
-
Net
:: HTTPHeader (36)
キーワード
-
/ (11) - == (19)
- =~ (12)
- [] (126)
- accept (12)
-
accept
_ nonblock (12) - at (12)
- backtrace (12)
-
backtrace
_ locations (12) - begins? (12)
- bytebegin (2)
-
ca
_ file= (12) - clamp (12)
-
connect
_ nonblock (12) - deq (24)
- div (12)
- each (12)
-
each
_ byte (24) -
each
_ line (12) - end (31)
-
error
_ bytes (12) - exception (24)
- exit (12)
- fetch (72)
- first (24)
- getc (12)
- gets (12)
-
initialize
_ copy (12) - key (8)
- kill (12)
- last (24)
- lineno (12)
- mkdir (18)
- next (12)
- offset (24)
-
ole
_ get _ methods (12) -
ole
_ query _ interface (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 (14)
-
recvfrom
_ nonblock (12) - reject (12)
-
set
_ backtrace (12) -
set
_ dictionary (12) - shift (24)
- slice (72)
- terminate (12)
- test (18)
-
to
_ json (12) - ungetc (12)
- unlock (12)
- unscan (12)
- value (12)
検索結果
先頭5件
-
MatchData
# begin(n) -> Integer | nil (21256.0) -
n 番目の部分文字列先頭のオフセットを返します。
...す。
@param n 部分文字列を指定する数値。
@raise IndexError 範囲外の 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 (21108.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Enumerator
:: ArithmeticSequence # begin -> Numeric | nil (21108.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Range
# begin -> object (18246.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......Error
//}
@see Range#end... -
MatchData
# bytebegin(n) -> Integer | nil (12325.0) -
n 番目の部分文字列先頭のバイトオフセットを返します。
...バイトオフセットを返します。
@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。
@raise IndexError 範囲外の n を指定した場合に発生します。
@raise IndexError 正規表現中で定義......。
//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.bytebegin(0) # => 2
p $~.bytebegin(1) # => 2
p $~.bytebegin(2) # => 6
p $~.bytebegin(3) # => 13
p $~.bytebegin(4) # => index 4 out of matches (IndexE......rror)
//}
//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.bytebegin(:key) # => 0
$~.bytebegin(:value) # => 6
$~.bytebegin(:foo) # => undefined group name reference: foo... -
MatchData
# bytebegin(name) -> Integer | nil (12325.0) -
n 番目の部分文字列先頭のバイトオフセットを返します。
...バイトオフセットを返します。
@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。
@raise IndexError 範囲外の n を指定した場合に発生します。
@raise IndexError 正規表現中で定義......。
//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.bytebegin(0) # => 2
p $~.bytebegin(1) # => 2
p $~.bytebegin(2) # => 6
p $~.bytebegin(3) # => 13
p $~.bytebegin(4) # => index 4 out of matches (IndexE......rror)
//}
//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.bytebegin(:key) # => 0
$~.bytebegin(:value) # => 6
$~.bytebegin(:foo) # => undefined group name reference: foo... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9213.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 (9213.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 (9213.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 # error _ bytes -> String (9113.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 (9113.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
//}... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (6843.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...g::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変......
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion aft......er output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buff...