るりまサーチ

最速Rubyリファレンスマニュアル検索!
256件ヒット [1-100件を表示] (0.112秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

MatchData#offset(name) -> [Integer, Integer] | [nil, nil] (18186.0)

name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。

...d] を返
します。

//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}

と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。

@
param name 名前(シンボルか文字列)

@
raise IndexError 正規表現中で...
...emlist[例][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] (18146.0)

n 番目の部分文字列のオフセットの配列 [start, end] を返 します。

...emlist[例][ruby]{
[ self.begin(n), self.end(n) ]
//}

と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。

@
param n 部分文字列を指定する数値

@
raise IndexError 範囲外の n を指定した場合に発生します。

@
see MatchDat...
...a#begin, MatchData#end, MatchData#offset...

MatchData#byteoffset(name) -> [Integer, Integer] | [nil, nil] (6141.0)

name という名前付きグループに対応する部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。

...します。

@
param name 名前(シンボルか文字列)

@
raise 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] (6131.0)

n 番目の部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。

...のオフセットの
配列 [start, end] を返します。

n番目の部分文字列がマッチしていなければ [nil, nil] を返します。

@
param n 部分文字列を指定する数値

@
raise IndexError 範囲外の n を指定した場合に発生します。

@
see MatchData#offset...

IO#advise(advice, offset=0, len=0) -> nil (186.0)

posix_fadvise(2) を呼びだし、 ファイルへのアクセスパターンをOSに知らせます。

...ォーム依存です。

ここでいう「データ」は offset と len で特定することができます。
len が 0 ならば、offset からファイル末尾までを指定したことになります。
デフォルトでは offset と len がともに 0 なので、
ファイル全体を...
...ません。

@
param advice アクセスパターンを表すシンボル
@
param offset パターンを指定するデータの先頭位置
@
param len パターンを指定するデータの長さ

@
raise IOError ストリームが既に閉じられているときに発生する例外
@
raise Errno::...
...ときに発生する例外
@
raise Errno::EINVAL advice が不正
@
raise Errno::ESPIPE ファイルデスクリプタが FIFO か pipe を指している
場合に発生する例外(Linux はこの場合には Errno::EINVAL を発生する)
@
raise RangeError offset,lenが有効範囲から出...

絞り込み条件を変える

String#byteindex(pattern, offset = 0) -> Integer | nil (166.0)

文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...文字列の offset から右に向かって pattern を検索し、
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。

引数 pattern は探索する部分文字列または正規表現で指定...
...索します。

@
param pattern 探索する部分文字列または正規表現
@
param offset 探索を開始するバイト単位のオフセット

@
raise IndexError オフセットが文字列の境界以外をさしているときに発生します。

//emlist[例][ruby]{
'foo'.byteinde...
...'o', -3) # => 1
'foo'.byteindex('o', -4) # => nil

'あいう'.byteindex('う') # => 6
'あいう'.byteindex('う', 3) # => 6
'あいう'.byteindex('う', -3) # => 6
'あいう'.byteindex('う', 1) # offset 1 does not land on character boundary (IndexError)
//}

@
see String#index, String#byterindex...

String#byterindex(pattern, offset = self.bytesize) -> Integer | nil (166.0)

文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。

...文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。

引数 pattern は探索する部...
...分文字列または正規表現で指定します。

offset
が負の場合は、文字列の末尾から数えた位置から探索します。

byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではあり...
...mlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}

//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("in...

IO#pwrite(string, offset) -> Integer (160.0)

stringをoffsetの位置にpwrite()システムコールを使って書き込みます。

...stringをoffsetの位置にpwrite()システムコールを使って書き込みます。

IO#seekとIO#writeの組み合わせと比べて、アトミックな操作に
なるという点が優れていて、複数スレッド/プロセスから同じIOオブジェクトを
様々な位置から読...
...ッファリングもバイパスします。

@
param string 書き込む文字列を指定します。
@
param offset ファイルポインタを変えずに書き込む位置を指定します。

@
return 書き込んだバイト数を返します。

@
raise Errno::EXXX シークまたは書き込...
...敗した場合に発生します。
@raise NotImplementedError システムコールがサポートされていない OS で発生します。

//emlist[例][ruby]{
File.open("testfile", "w") do |f|
f.pwrite("ABCDEF", 3) # => 6
end

File.read("testfile") # => "\u0000\u0000\u0000ABCDEF"
//}...

IO#pread(maxlen, offset, outbuf = "") -> string (150.0)

preadシステムコールを使ってファイルポインタを変更せずに、また現在のファイルポインタに 依存せずにmaxlenバイト読み込みます。

...グもバイパスします。

@
param maxlen 読み込むバイト数を指定します。
@
param offset 読み込み開始位置のファイルの先頭からのオフセットを指定します。
@
param outbuf データを受け取る String を指定します。

@
raise Errno::EXXX シークま...
...は書き込みが失敗した場合に発生します。
@
raise EOFError EOF に到達した時に発生します。
@
raise NotImplementedError システムコールがサポートされていない OS で発生します。

//emlist[例][ruby]{
File.write("testfile", "This is line one\nThis is lin...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (143.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...になります。

@
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 after output before input...
...e
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p...

絞り込み条件を変える

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (143.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...になります。

@
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 after output before input...
...e
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (143.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...になります。

@
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 after output before input...
...e
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''

begin
ret = ec.primitive_convert(src, dst)
p...
<< 1 2 3 > >>