種類
- インスタンスメソッド (285)
- 特異メソッド (99)
クラス
-
ARGF
. class (11) -
Encoding
:: Converter (33) - Enumerator (22)
-
Enumerator
:: Lazy (10) - IO (146)
- MatchData (26)
- Regexp (22)
- String (4)
- Struct (11)
- Time (77)
モジュール
- Enumerable (22)
キーワード
- [] (11)
- advise (11)
- binread (11)
- binwrite (11)
- byteindex (2)
- byteoffset (4)
- byterindex (2)
-
copy
_ stream (22) -
each
_ with _ index (22) - getlocal (22)
-
gmt
_ offset (11) - gmtoff (11)
- localtime (22)
- match (22)
- pread (7)
-
primitive
_ convert (33) - pwrite (7)
- read (33)
- seek (22)
- sysseek (11)
-
utc
_ offset (11) -
with
_ index (32) - write (22)
検索結果
先頭5件
-
MatchData
# offset(name) -> [Integer , Integer] | [nil , nil] (32253.0) -
name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。
...name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返
します。
//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}
と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, ni......ame 名前(シンボルか文字列)
@raise IndexError 正規表現中で定義されていない name を指定した場合に発生します。
//emlist[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.offset('year') # => [0, 4]
p $~.offset(:yea......r) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#begin, MatchData#end......r) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#begin, MatchData#end, MatchData#offset... -
MatchData
# offset(n) -> [Integer , Integer] | [nil , nil] (32218.0) -
n 番目の部分文字列のオフセットの配列 [start, end] を返 します。
...ットの配列 [start, end] を返
します。
//emlist[例][ruby]{
[ self.begin(n), self.end(n) ]
//}
と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を......指定した場合に発生します。
@see MatchData#begin, MatchData#end......指定した場合に発生します。
@see MatchData#begin, MatchData#end, MatchData#offset... -
Time
# gmt _ offset -> Integer (20216.0) -
協定世界時との時差を秒を単位とする数値として返します。
...//emlist[地方時の場合][ruby]{
p Time.now.zone # => "JST"
p Time.now.utc_offset # => 32400
//}
タイムゾーンが協定世界時に設定されている場合は 0 を返します。
//emlist[協定世界時の場合][ruby]{
p Time.now.getgm.zone # => "UTC"
p Time.now.getgm.......utc_offset # => 0
//}... -
Time
# utc _ offset -> Integer (20216.0) -
協定世界時との時差を秒を単位とする数値として返します。
...//emlist[地方時の場合][ruby]{
p Time.now.zone # => "JST"
p Time.now.utc_offset # => 32400
//}
タイムゾーンが協定世界時に設定されている場合は 0 を返します。
//emlist[協定世界時の場合][ruby]{
p Time.now.getgm.zone # => "UTC"
p Time.now.getgm.......utc_offset # => 0
//}... -
MatchData
# byteoffset(name) -> [Integer , Integer] | [nil , nil] (20215.0) -
name という名前付きグループに対応する部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。
...name という名前付きグループに対応する部分文字列のバイト単位のオフセットの
配列 [start, end] を返します。
nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。
@param name 名前(シンボルか文字......se IndexError 正規表現中で定義されていない name を指定した場合に発生します。
//emlist[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.byteoffset('year') # => [0, 4]
p $~.byteoffset(:year) # => [0, 4]
p $~.byteoffset......('month') # => [7, 8]
p $~.byteoffset(:month) # => [7, 8]
p $~.byteoffset('day') # => [nil, nil]
p $~.byteoffset('century') # => `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#offset... -
MatchData
# byteoffset(n) -> [Integer , Integer] | [nil , nil] (20210.0) -
n 番目の部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。
...のオフセットの
配列 [start, end] を返します。
n番目の部分文字列がマッチしていなければ [nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を指定した場合に発生します。
@see MatchData#offset... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (14431.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...イト単位のインデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。
引数 pattern は探索する部分文字列ま......たは正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探......//emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex(... -
IO
# seek(offset , whence = IO :: SEEK _ SET) -> 0 (14353.0) -
ファイルポインタを whence の位置から offset だけ移動させます。 offset 位置への移動が成功すれば 0 を返します。
...ファイルポインタを whence の位置から offset だけ移動させます。
offset 位置への移動が成功すれば 0 を返します。
@param offset ファイルポインタを移動させるオフセットを整数で指定します。
@param whence 値は以下のいずれかで......りに :SET、:CUR、:END、:DATA、:HOLE を指定す
る事も可能です。
* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO::SEEK_CUR: 現在のファイルポインタから
* IO::SEEK_END: ファイルの末尾から
* IO::SEEK_DATA: offset 以降の......がある位置へ(lseek の man ページ参照。Linux 3.1 以降のみ)
* IO::SEEK_HOLE: offset 以降の次にホールがある位置へ(同上)
@raise Errno::EXXX ファイルポインタの移動に失敗した場合に発生します。
@raise IOError 既に close されていた場合... -
ARGF
. class # seek(offset , whence = IO :: SEEK _ SET) -> 0 (14341.0) -
ARGFが現在開いているファイルのファイルポインタを whence の位置から offset だけ移動させます。 offset 位置への移動が成功すれば 0 を返します。
...イルポインタを whence の位置から
offset だけ移動させます。 offset 位置への移動が成功すれば 0 を返します。
@param offset ファイルポインタを移動させるオフセットを整数で指定します。
@param whence IO#seek を参照。
@see IO#seek... -
IO
# sysseek(offset , whence = IO :: SEEK _ SET) -> Integer (14337.0) -
lseek(2) と同じです。IO#seek では、 IO#sysread, IO#syswrite と併用すると正しく動作しないので代わりにこのメソッドを使います。 位置 offset への移動が成功すれば移動した位置(ファイル先頭からのオフセット)を返します。
...lseek(2) と同じです。IO#seek では、
IO#sysread, IO#syswrite と併用すると正しく動作しないので代わりにこのメソッドを使います。
位置 offset への移動が成功すれば移動した位置(ファイル先頭からのオフセット)を返します。
書き......出ます。
File.open("/dev/zero") {|f|
buf = f.read(3)
f.sysseek(0)
}
# => -:3:in `sysseek': sysseek for buffered IO (IOError)
File.open("/dev/null", "w") {|f|
f.print "foo"
f.sysseek(0)
}
# => -:3: warning: sysseek for buffered IO
@param offset ファイルポイ......定します。
@param whence 値は以下のいずれかです。
それぞれ代わりに :SET、:CUR、:END、:DATA、:HOLE を指定す
る事も可能です。
* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO::SEEK_CUR: 現在のファイル... -
Time
# getlocal(utc _ offset) -> Time (14309.0) -
タイムゾーンを地方時に設定した Time オブジェクトを新しく生成 して返します。
...タイムゾーンを地方時に設定した Time オブジェクトを新しく生成
して返します。
@param utc_offset タイムゾーンを地方時に設定する代わりに協定世界時との
時差を、秒を単位とする整数か、"+HH:MM" "-HH:MM" 形式......。
//emlist[][ruby]{
p t = Time.utc(2000,1,1,20,15,1) # => 2000-01-01 20:15:01 UTC
p t.utc? # => true
p l = t.getlocal # => 2000-01-02 05:15:01 +0900
p l.utc? # => false
p t == l # => true
p j = t.getlocal......("+09:00") # => 2000-01-02 05:15:01 +0900
p j.utc? # => false
p t == j # => true
//}... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (14302.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes......ze 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true......op conversion after 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...