332件ヒット
[1-100件を表示]
(0.152秒)
ライブラリ
- ビルトイン (237)
- json (11)
- optparse (11)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - socket (11)
- zlib (44)
クラス
- Array (44)
-
Encoding
:: Converter (44) -
Enumerator
:: ArithmeticSequence (17) - Exception (11)
-
File
:: Stat (11) -
JSON
:: State (11) - LoadError (11)
- MatchData (44)
- OptionParser (11)
- Random (33)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - StopIteration (11)
- Thread (11)
- UDPSocket (11)
-
Zlib
:: GzipReader (33) -
Zlib
:: Inflate (11)
キーワード
- == (6)
- [] (33)
- accept (11)
-
backtrace
_ locations (11) -
check
_ circular? (11) - each (11)
-
each
_ byte (11) -
each
_ line (11) - end (17)
- mkdir (18)
- offset (22)
- path (11)
-
primitive
_ convert (44) - rand (33)
-
recvfrom
_ nonblock (11) - result (11)
-
set
_ dictionary (11) - sticky? (11)
- terminate (11)
検索結果
先頭5件
-
MatchData
# begin(n) -> Integer | nil (24238.0) -
n 番目の部分文字列先頭のオフセットを返します。
...nilを返します。
@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 | nil (21202.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Array
# at(nth) -> object | nil (15207.0) -
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
...nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
@param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックス......みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [ "a", "b", "c", "d", "e" ]
a[0] #=> "a"
a[1] #=> "b"
a[-1] #=> "e"
a[-2] #=> "d"
a[10] #=> nil
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (12407.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not l......ong 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_exception'", "test.rb:15:in `<main>'"]
//}
@see... -
LoadError
# path -> String | nil (9207.0) -
Kernel.#require や Kernel.#load に失敗したパスを返します。
...Kernel.#require や Kernel.#load に失敗したパスを返します。
begin
require 'this/file/does/not/exist'
rescue LoadError => e
e.path # => 'this/file/does/not/exist'
end
パスが定まらない場合は nil を返します。... -
JSON
:: State # check _ circular? -> bool (9107.0) -
循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。
...emlist[例 ネストをチェックするケース][ruby]{
require "json"
a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s = JSON.state.......new
begin
JSON.generate(a, s)
rescue JSON::NestingError => e
[e, s.max_nesting, s.check_circular?] # => [#<JSON::NestingError: nesting of 100 is too deep>, 100, true]
end
//}
//emlist[例 ネストをチェックしないケース][ruby]{
require "json"
a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[......]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json = JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[... -
StopIteration
# result -> object (9107.0) -
この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。
...ect = Object.new
def object.each
yield :yield1
yield :yield2
:each_returned
end
enumerator = object.to_enum
p enumerator.next #=> :yield1
p enumerator.next #=> :yield2
begin
enumerator.next
rescue StopIteration => error
p error.result #=> :each_returned
end... -
Zlib
:: GzipReader # each _ line(rs = $ / ) -> Enumerator (6207.0) -
IO クラスの同名メソッドIO#each, IO#each_lineと同じです。
...IO クラスの同名メソッドIO#each, IO#each_lineと同じです。
但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。
gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルの......合は
Zlib::GzipFile::NoFooter, Zlib::GzipFile::CRCError,
Zlib::GzipFile::LengthError 例外を発生させます。
* EOF (圧縮データの最後) を越えて読み込み要求を受けた時。
すなわち Zlib::GzipReader#read,
Zlib::GzipReader#gets メソッド等が nil を返......、Zlib::GzipFile#close メソッドが
呼び出された時。
* EOF まで読み込んだ後、Zlib::GzipReader#unused メソッドが
呼び出された時。
@param rs 行の区切りを文字列で指定します。
@raise Zlib::Error Zlib::Error を参照
@raise Zlib::GzipFile::Err... -
UDPSocket
# recvfrom _ nonblock(maxlen , flags=0) -> [String , Array] (6119.0) -
ソケットをノンブロッキングモードに設定した後、 recvfrom(2) でソケットからデータを受け取ります。
...キングモードに設定した後、
recvfrom(2) でソケットからデータを受け取ります。
maxlen で受け取るデータの最大バイト数を指定します。
flags はフラグで、Socket::MSG_* の bitwise OR を渡します。
詳しくは recvfrom(2) を参照してく......IN, Errno::EINTR を含め例外 Errno::EXXX が発生します。
Errno::EWOULDBLOCK、Errno::EAGAIN のような待ってからリトライすることが
可能であることを意味する例外には、IO::WaitReadable が extend
されています。
require 'socket'
s1 = UDPSocket.new......ddr.values_at(3,1))
s1.connect(*s2.addr.values_at(3,1))
s1.send "aaa", 0
begin # emulate blocking recvfrom
p s2.recvfrom_nonblock(10)
#=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
rescue IO::WaitReadable
IO.select([s2])
retry
end
@param maxlen 受... -
MatchData
# offset(n) -> [Integer , Integer] | [nil , nil] (6115.0) -
n 番目の部分文字列のオフセットの配列 [start, end] を返 します。
...mlist[例][ruby]{
[ self.begin(n), self.end(n) ]
//}
と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を指定した場合に発生します。
@see MatchData......#begin, MatchData#end......#begin, MatchData#end, MatchData#offset...