るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.039秒)
トップページ > クエリ:path[x] > バージョン:2.6.0[x] > クラス:IO[x] > クエリ:readlines[x]

別のキーワード

  1. _builtin path
  2. pathname to_path
  3. _builtin absolute_path
  4. _builtin to_path
  5. pstore path

検索結果

IO.readlines(path, limit, chomp: false, opts={}) -> [String] (54796.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}

//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO
.write("testfile",...
..."line1,\rline2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...

IO.readlines(path, rs = $/, chomp: false, opts={}) -> [String] (54796.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}

//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO
.write("testfile",...
..."line1,\rline2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...

IO.readlines(path, rs, limit, chomp: false, opts={}) -> [String] (54796.0)

path で指定されたファイルを全て読み込んで、その各行を要素としてもつ配列を返します。

...emlist[例][ruby]{
IO
.write("testfile", "line1\nline2,\nline3\n")
IO
.readlines("testfile") # => ["line1\n", "line2,\n", "line3\n"]
IO
.readlines("testfile", ",") # => ["line1\nline2,", "\nline3\n"]
//}

//emlist[例: rs を取り除く(chomp = true)][ruby]{
IO
.write("testfile",...
..."line1,\rline2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...

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

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

...ぎます。
IO
#pos, IO#lineno などはリセットされます。

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

@param mode パスを開く際のモードを文字列で指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("test...

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

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

...ぎます。
IO
#pos, IO#lineno などはリセットされます。

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

@param mode パスを開く際のモードを文字列で指定します。

@raise Errno::EXXX 失敗した場合に発生します。

//emlist[例][ruby]{
IO
.write("test...

絞り込み条件を変える

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

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

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

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

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

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