るりまサーチ

最速Rubyリファレンスマニュアル検索!
258件ヒット [1-100件を表示] (0.038秒)
トップページ > クエリ:File[x] > クエリ:IO[x] > クエリ:readline[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file atime
  4. file mtime
  5. file open

ライブラリ

クラス

モジュール

検索結果

<< 1 2 3 > >>

IO#readline(limit) -> String (39139.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。

...が発生します。

テキスト読み込みメソッドとして動作します。

読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。

limit で最大読み込みバイト数を指定します。ただしマルチバイト...
...します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline #...
...=> EOFError
$_ #=> nil

@see $/, IO#gets...

IO#readline(limit, chomp: false) -> String (39139.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。

...が発生します。

テキスト読み込みメソッドとして動作します。

読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。

limit で最大読み込みバイト数を指定します。ただしマルチバイト...
...します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline #...
...=> EOFError
$_ #=> nil

@see $/, IO#gets...

IO#readline(rs = $/) -> String (39139.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。

...が発生します。

テキスト読み込みメソッドとして動作します。

読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。

limit で最大読み込みバイト数を指定します。ただしマルチバイト...
...します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline #...
...=> EOFError
$_ #=> nil

@see $/, IO#gets...

IO#readline(rs = $/, chomp: false) -> String (39139.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。

...が発生します。

テキスト読み込みメソッドとして動作します。

読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。

limit で最大読み込みバイト数を指定します。ただしマルチバイト...
...します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline #...
...=> EOFError
$_ #=> nil

@see $/, IO#gets...

IO#readline(rs, limit) -> String (39139.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。

...が発生します。

テキスト読み込みメソッドとして動作します。

読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。

limit で最大読み込みバイト数を指定します。ただしマルチバイト...
...します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline #...
...=> EOFError
$_ #=> nil

@see $/, IO#gets...

絞り込み条件を変える

IO#readline(rs, limit, chomp: false) -> String (39139.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には EOFError が発生します。

...が発生します。

テキスト読み込みメソッドとして動作します。

読み込んだ文字列を変数 $_ にセットします。IO#gets との違いは EOF での振る舞いのみです。

limit で最大読み込みバイト数を指定します。ただしマルチバイト...
...します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.readline #=> "This is line one\n"
$_ #=> "This is line one\n"
f.readline #...
...=> EOFError
$_ #=> nil

@see $/, IO#gets...

IO (38438.0)

基本的な入出力機能のためのクラスです。

...基本的な入出力機能のためのクラスです。


File
::Constants は、File から IO へ移動しました。

===[a:m17n] 多言語化と IO のエンコーディング

IO
オブジェクトはエンコーディングを持ちます。
エンコーディングの影響を受けるメ...
...と受けないメソッドがあります。

影響を受けるメソッドでは、IO のエンコーディングに従い読み込まれた文字列のエンコーディングが決定されます。
また IO のエンコーディングを適切に設定することにより、読み込み時...
... IO のエンコーディングの影響をうけます。
詳しくは「io_encoding」を参照して下さい。
以下がテキスト読み込みメソッドです。

* IO.foreach
* IO.readlines
* IO#each_line
* IO#lines
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#rea...
... IO のエンコーディングの影響をうけます。
詳しくは「io_encoding」を参照して下さい。
以下がテキスト読み込みメソッドです。

* IO.foreach
* IO.readlines
* IO#each_line
* IO#gets
* IO#getc
* IO#ungetc
* IO#read
* IO#readchar
* IO#readline
* IO#...

Readline::FILENAME_COMPLETION_PROC -> Proc (29238.0)

GNU Readline で定義されている関数を使用してファイル名の補完を行うための Proc オブジェクトです。 Readline.completion_proc= で使用します。

...GNU Readline で定義されている関数を使用してファイル名の補完を行うための
Proc オブジェクトです。
Readline
.completion_proc= で使用します。

@see Readline.completion_proc=...

IO#readlines(limit, chomp: false) -> [String] (27148.0)

データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。

...aise IOError 自身が読み込み用にオープンされていなければ発生します。

//emlist[例][ruby]{
IO
.write("testfile", "line1,\nline2,\nline3,\n")
File
.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File
.open("testfile") { |f| p f.readlines(3...
..."\n", "lin", "e3,", "\n"]
File
.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}

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

@see $/, IO#gets...

IO#readlines(rs = $/, chomp: false) -> [String] (27148.0)

データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。

...aise IOError 自身が読み込み用にオープンされていなければ発生します。

//emlist[例][ruby]{
IO
.write("testfile", "line1,\nline2,\nline3,\n")
File
.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File
.open("testfile") { |f| p f.readlines(3...
..."\n", "lin", "e3,", "\n"]
File
.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}

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

@see $/, IO#gets...

絞り込み条件を変える

IO#readlines(rs, limit, chomp: false) -> [String] (27148.0)

データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。

...aise IOError 自身が読み込み用にオープンされていなければ発生します。

//emlist[例][ruby]{
IO
.write("testfile", "line1,\nline2,\nline3,\n")
File
.open("testfile") { |f| p f.readlines } # => ["line1,\n", "line2,\n", "line3,\n"]
File
.open("testfile") { |f| p f.readlines(3...
..."\n", "lin", "e3,", "\n"]
File
.open("testfile") { |f| p f.readlines(",") } # => ["line1,", "\nline2,", "\nline3,", "\n"]
//}

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

@see $/, IO#gets...

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

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

...あります。

opts でファイルを開くときのオプションを指定します。エンコーディングなど
を指定できます。
File
.open と同様なのでそちらを参照してください。

@param path ファイル名を表す文字列か "|コマンド名" を指定しま...
...][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,\r...
...line2,\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] (27142.0)

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

...あります。

opts でファイルを開くときのオプションを指定します。エンコーディングなど
を指定できます。
File
.open と同様なのでそちらを参照してください。

@param path ファイル名を表す文字列か "|コマンド名" を指定しま...
...][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,\r...
...line2,\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] (27142.0)

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

...あります。

opts でファイルを開くときのオプションを指定します。エンコーディングなど
を指定できます。
File
.open と同様なのでそちらを参照してください。

@param path ファイル名を表す文字列か "|コマンド名" を指定しま...
...][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,\r...
...line2,\r\nline3,\n")
IO
.readlines("testfile", chomp: true) # => ["line1,\rline2,", "line3,"]
IO
.readlines("testfile", "\r", chomp: true) # => ["line1,", "line2,", "\nline3,\n"]
//}...
<< 1 2 3 > >>