るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

IO#pos -> Integer (24221.0)

ファイルポインタの現在の位置を整数で返します。

...タの現在の位置を整数で返します。

@raise IOError 既に close されている場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\n")
File.open("testfile") do |f|
f.pos # => 0
f.gets # => "This is line one\n"
f.pos # => 17
end
//}...

IO#pos=(n) (12221.0)

ファイルポインタを指定位置に移動します。 IO#seek(n, IO::SEEK_SET) と同じです。

...ます。
IO
#seek(n, IO::SEEK_SET) と同じです。

@param n 先頭からのオフセットを整数で指定します。

@raise IOError 既に close されている場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\nThis is line two\n")
File.open("testfile"...
...) do |f|
f.pos # => 0
f.pos = 17
f.gets # => "This is line two\n"
end
//}...

IO#reopen(path) -> self (6115.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...
p
ath で指定されたファイルにストリームを繋ぎ換えます。

第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO
#pos, IO#lineno などはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パ...
...

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<...
...File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#open...

IO#reopen(path, mode) -> self (6115.0)

path で指定されたファイルにストリームを繋ぎ換えます。

...
p
ath で指定されたファイルにストリームを繋ぎ換えます。

第二引数を省略したとき self のモードをそのまま引き継ぎます。
IO
#pos, IO#lineno などはリセットされます。

@param path パスを表す文字列を指定します。

@param mode パ...
...

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r") # => #<...
...File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}

@see Kernel.#open...

IO#reopen(io) -> self (6110.0)

自身を指定された io に繋ぎ換えます。

... io に繋ぎ換えます。

クラスも io に等しくなることに注意してください。
IO
#pos, IO#lineno などは指定された io と等しくなります。

@param io 自身を繋ぎ換えたい IO オブジェクトを指定します。

@raise IOError 指定された io が c...

絞り込み条件を変える

IO#tell -> Integer (6021.0)

ファイルポインタの現在の位置を整数で返します。

...タの現在の位置を整数で返します。

@raise IOError 既に close されている場合に発生します。

//emlist[例][ruby]{
IO
.write("testfile", "This is line one\n")
File.open("testfile") do |f|
f.pos # => 0
f.gets # => "This is line one\n"
f.pos # => 17
end
//}...