るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. dh p

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

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

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

...列 [start, end] を返
します。

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

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

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

@raise IndexError 正規...
...>\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 g...
...roup name reference: century (IndexError)
//}

@see MatchData#begin, MatchData#end...
...roup name reference: century (IndexError)
//}

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

MatchData#offset(n) -> [Integer, Integer] | [nil, nil] (21126.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...

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

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

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

IO#seekとIO#readの組み合わせと比べて、アトミックな操作に
なるという点が優れていて、複...
...間のIO層のバッファリングもバイパスします。

@param maxlen 読み込むバイト数を指定します。
@param offset 読み込み開始位置のファイルの先頭からのオフセットを指定します。
@param outbuf データを受け取る String を指定します。...
...se NotImplementedError システムコールがサポートされていない OS で発生します。

//emlist[例][ruby]{
File.write("testfile", "This is line one\nThis is line two\n")
File.open("testfile") do |f|
p
f.read # => "This is line one\nThis is line two\n"
p
f.pread(12, 0)...

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

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

...は、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put 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_buffer_emp...

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

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

...は、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put 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_buffer_emp...

絞り込み条件を変える

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

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

...は、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination...
...容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversi...
...put 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_buffer_emp...

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

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

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

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

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

@raise IndexError 正規表現中で定義されていない name...
...?<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('centur...
...y') # => `offset': undefined group name reference: century (IndexError)
//}

@see MatchData#offset...

MatchData#byteoffset(n) -> [Integer, Integer] | [nil, nil] (9118.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 (6342.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...

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

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

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

advice には以下のいずれかのシンボルを指定します。
* :normal - デフォルト
* :sequential - データは前から順にアクセスされる
* :random - データ...
...はランダムアクセスされる
* :willneed - データはこの直後にアクセスされる
* :dontneed - データは直後にはアクセスしない
* :noreuse - データは一度しかアクセスされない
これらの advice が具体的に何をするのかはプラットフ...
...」は offset と len で特定することができます。
len が 0 ならば、offset からファイル末尾までを指定したことになります。
デフォルトでは offset と len がともに 0 なので、
ファイル全体を指定したことになります。

p
osix_fadvise...

絞り込み条件を変える

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

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

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

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

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

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

//emlist[例][ruby]{
'foo'.byteindex('f') #...
...0
'foo'.byteindex('o') # => 1
'foo'.byteindex('oo') # => 1
'foo'.byteindex('ooo') # => nil

'foo'.byteindex(/f/) # => 0
'foo'.byteindex(/o/) # => 1
'foo'.byteindex(/oo/) # => 1
'foo'.byteindex(/ooo/) # => nil

'foo'.byteindex('o', 1) # => 1
'foo'.byteindex('o', 2) # => 2
'foo'.byteindex('o', 3) # =...

Enumerator#with_index(offset = 0) -> Enumerator (6237.0)

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。

...ンデックスは offset から始まります。

ブロックを指定した場合の戻り値は生成時に指定したレシーバ自身です。

//emlist[例][ruby]{
str = "xyz"

enum = Enumerator.new {|y| str.each_byte {|b| y << b }}
enum.with_index {|byte, idx| p [byte, idx] }
# => [12...
...h_index(1) {|s, i| p [s, i] }
# => ["foo|", 1]
# ["bar|", 2]
# ["baz", 3]
//}


生成時のパラメータに従って、要素にインデックスを添えてブロックを繰り返します。
インデックスは 0 から始まります。
Enumerator#with_index は offset...
...引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。...
<< 1 2 3 > >>