種類
- インスタンスメソッド (362)
- 特異メソッド (165)
- 文書 (42)
- 定数 (22)
- 関数 (9)
ライブラリ
クラス
-
ARGF
. class (11) -
CSV
:: Row (11) - DateTime (77)
-
Encoding
:: Converter (33) - Enumerator (22)
-
Enumerator
:: Lazy (10) -
Fiddle
:: Pointer (22) - IO (124)
- MatchData (26)
-
Net
:: FTP (44) - Pathname (22)
-
Psych
:: SyntaxError (11) - Regexp (22)
- Socket (11)
- String (4)
- StringIO (11)
- Struct (11)
- Time (33)
-
WIN32OLE
_ METHOD (11)
モジュール
- Enumerable (22)
-
Socket
:: Constants (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
IPV6
_ CHECKSUM (22) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 1 . 0 (3) - [] (33)
-
_ strptime (11) - binread (11)
- binwrite (22)
- byteindex (2)
- byteoffset (4)
- byterindex (2)
- civil (11)
- commercial (11)
-
copy
_ stream (22) - delete (11)
-
each
_ with _ index (22) -
gmt
_ offset (11) - gmtoff (11)
- jd (11)
- match (22)
- new (11)
-
offset
_ vtbl (11) - ordinal (11)
- pread (7)
-
primitive
_ convert (33) - pwrite (7)
-
rb
_ time _ timespec _ new (9) - read (33)
- retrbinary (22)
-
ruby 1
. 9 feature (11) - seek (22)
- storbinary (22)
- sysseek (11)
-
utc
_ offset (11) -
with
_ index (32) - write (33)
検索結果
先頭5件
-
Psych
:: SyntaxError # offset -> Integer (21323.0) -
エラーが生じた位置の offset をバイト数で 返します。
...エラーが生じた位置の offset をバイト数で
返します。
offset とは、
Psych::SyntaxError#line, Psych::SyntaxError#column
で指示される位置からの相対位置です。
この位置から 0 バイトの位置でエラーが発生することが多いため、
このメ... -
MatchData
# offset(name) -> [Integer , Integer] | [nil , nil] (18351.0) -
name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。
...列 [start, end] を返
します。
//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}
と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。
@param name 名前(シンボルか文字列)
@raise IndexError 正規......st[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.offset('year') # => [0, 4]
p $~.offset(:year) # => [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......> `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#begin, MatchData#end, MatchData#offset... -
MatchData
# offset(n) -> [Integer , Integer] | [nil , nil] (18316.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, MatchData#offset... -
DateTime
# offset -> Rational (18301.0) -
時差を返します。
時差を返します。 -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (9377.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...イト単位のインデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。
引数 pattern は探索する部分文字列ま......たは正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探......String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("ing", -1... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (9312.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by......aram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after......rter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
sr... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (9312.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by......aram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after......rter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
sr... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (9312.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by......aram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after......rter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
sr... -
IO
. binwrite(path , string , offset=nil) -> Integer (6425.0) -
path で指定されるファイルを開き、string を書き込み、 閉じます。
...path で指定されるファイルを開き、string を書き込み、
閉じます。
ファイルを開くときの mode が "rb:ASCII-8BIT" で、バイナリモードが有効
である点以外は IO.write と同じです。
Kernel.#open と同様 path の先頭が "|" ならば、"|" に......。
offset を指定するとその位置までシークします。
offset を指定しないと、書き込みの末尾でファイルを
切り捨てます。
@param path ファイル名文字列
@param string 書き込む文字列
@param offset 書き込み開始位置
//emlist[例][ruby]{
#......8x8の真っ白なPNG画像データ。
png = 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAAAAADhZOFXAAAADklEQVQIW2P4DwUMlDEA98A/wTjP
QBoAAAAASUVORK5CYII='.unpack('m').first
# 期待する先頭16バイトの16進ダンプ: どの環境でも同じ。
puts png[0...16].unpack('C*').map {|c| '%02x' % c }.join... -
IO
# pwrite(string , offset) -> Integer (6423.0) -
stringをoffsetの位置にpwrite()システムコールを使って書き込みます。
...stringをoffsetの位置にpwrite()システムコールを使って書き込みます。
IO#seekとIO#writeの組み合わせと比べて、アトミックな操作に
なるという点が優れていて、複数スレッド/プロセスから同じIOオブジェクトを
様々な位置から読......param string 書き込む文字列を指定します。
@param offset ファイルポインタを変えずに書き込む位置を指定します。
@return 書き込んだバイト数を返します。
@raise Errno::EXXX シークまたは書き込みが失敗した場合に発生します。
@ra......ise NotImplementedError システムコールがサポートされていない OS で発生します。
//emlist[例][ruby]{
File.open("testfile", "w") do |f|
f.pwrite("ABCDEF", 3) # => 6
end
File.read("testfile") # => "\u0000\u0000\u0000ABCDEF"
//}... -
IO
. write(path , string , offset=nil , **opts) -> Integer (6419.0) -
path で指定されるファイルを開き、string を書き込み、 閉じます。
...を開き、string を書き込み、
閉じます。
Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドを実行し、コマンドの出力を標準出力に書き込みます。
offset を指定するとその位置までシークします。
offset を指定し......。
@param path ファイル名文字列
@param string 書き込む文字列
@param offset 書き込み開始位置
@param opts ファイルを開くときのキーワード引数
//emlist[例][ruby]{
text = "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
IO.write("testfil......text) # => 66
IO.write("testfile", "0123456789", 20) #=> 10
IO.read("testfile")
# => "This is line one\nThi0123456789two\nThis is line three\nAnd so on...\n"
IO.write("testfile", "0123456789") #=> 10
IO.read("testfile") # => "0123456789"
//}
@see IO.binwrite...