るりまサーチ

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

別のキーワード

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

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

MatchData#offset(name) -> [Integer, Integer] | [nil, nil] (18189.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
$~.offset('year') # => [0, 4]
p
$~.o...
...ffset(: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...
...ffset(: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, MatchData#offset...

MatchData#offset(n) -> [Integer, Integer] | [nil, nil] (18124.0)

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

...by]{
[ self.begin(n), self.end(n) ]
//}

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

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

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

@see MatchData#begin, Match...
...end(n) ]
//}

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

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

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

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

IO.copy_stream(src, dst, copy_length, src_offset) -> Integer (6315.0)

指定された src から dst へコピーします。 コピーしたバイト数を返します。

...src_offset が指定されている場合、
src のオフセット(src.pos)は変更されません。

@param src コピー元となる IO オブジェクトかファイル名を指定します。

@param dst コピー先となる IO オブジェクトかファイル名を指定します。

@para...
...m copy_length コピーする長さをバイト単位で指定します。最大 copy_length までコピーされます。
nil を指定した場合、コピーする長さに制限はありません。

@param src_offset コピーを始めるオフセットを数値で指定し...
...ます。

//emlist[例][ruby]{
IO.write("filetest", "abcdefghij")
IO.copy_stream("filetest", "filecopy", 2) # => 2
IO.read("filecopy") # => "ab"
IO.copy_stream("filetest", "filecopy", 3, 4) # => 3
IO.read("filecopy") # => "efg"
//}...

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

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

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

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

@param maxlen 読み込むバイト数を指定します。
@param offset 読み込み開始位置のファイルの先頭からのオフセットを指定します。
@param outbuf データを受け取る String を指定します。...
...aise 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,...

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

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

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

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

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

@return 書き込んだバイト数...
...は書き込みが失敗した場合に発生します。
@raise NotImplementedError システムコールがサポートされていない OS で発生します。

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

File.read("testfile") # => "\u0000\u0...

絞り込み条件を変える

IO.copy_stream(src, dst, copy_length = nil) -> Integer (6215.0)

指定された src から dst へコピーします。 コピーしたバイト数を返します。

...src_offset が指定されている場合、
src のオフセット(src.pos)は変更されません。

@param src コピー元となる IO オブジェクトかファイル名を指定します。

@param dst コピー先となる IO オブジェクトかファイル名を指定します。

@para...
...m copy_length コピーする長さをバイト単位で指定します。最大 copy_length までコピーされます。
nil を指定した場合、コピーする長さに制限はありません。

@param src_offset コピーを始めるオフセットを数値で指定し...
...ます。

//emlist[例][ruby]{
IO.write("filetest", "abcdefghij")
IO.copy_stream("filetest", "filecopy", 2) # => 2
IO.read("filecopy") # => "ab"
IO.copy_stream("filetest", "filecopy", 3, 4) # => 3
IO.read("filecopy") # => "efg"
//}...

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

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

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

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@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) -> Symbol (6208.0)

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

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

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@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 (6208.0)

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

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

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytes...
...容量
@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] (6151.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...

絞り込み条件を変える

Time#gmt_offset -> Integer (6140.0)

協定世界時との時差を秒を単位とする数値として返します。

...合][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
//}...
<< 1 2 3 ... > >>