るりまサーチ

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

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io readlines
  5. io each_line

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

IO#gets(limit) -> String | nil (27128.0)

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

...il を返します。

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

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

limit で最大の読み込みバイト数を指定します。ただし
ファイ...
...みバイト数

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

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

@see $/, IO#readline...

IO#gets(limit, chomp: false) -> String | nil (27128.0)

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

...il を返します。

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

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

limit で最大の読み込みバイト数を指定します。ただし
ファイ...
...除きます。

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

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

@see $/, IO#readline...

IO#gets(rs = $/) -> String | nil (27128.0)

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

...il を返します。

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

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

limit で最大の読み込みバイト数を指定します。ただし
ファイ...
...みバイト数

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

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

@see $/, IO#readline...

IO#gets(rs = $/, chomp: false) -> String | nil (27128.0)

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

...il を返します。

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

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

limit で最大の読み込みバイト数を指定します。ただし
ファイ...
...除きます。

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

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

@see $/, IO#readline...

IO#gets(rs, limit) -> String | nil (27128.0)

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

...il を返します。

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

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

limit で最大の読み込みバイト数を指定します。ただし
ファイ...
...みバイト数

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

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

@see $/, IO#readline...

絞り込み条件を変える

IO#gets(rs, limit, chomp: false) -> String | nil (27128.0)

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

...il を返します。

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

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

limit で最大の読み込みバイト数を指定します。ただし
ファイ...
...除きます。

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

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

@see $/, IO#readline...

StringIO#gets(rs = $/) -> String | nil (21114.0)

自身から 1 行読み込んで、その文字列を返します。文字列の終端に到達した時には nil を返します。 $_ に読み込んだ行がセットされます。

...ラグラフモード)。

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

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge")
a.gets #=> "hoge"
$_ #=> "hoge"
a.gets #=> nil
$_...

IRB::StdioInputMethod#gets -> String (21102.0)

標準入力から文字列を 1 行読み込みます。

標準入力から文字列を 1 行読み込みます。

Zlib::GzipReader#gets(rs = $/) -> String | nil (18162.0)

IO クラスの同名メソッドIO#getsと同じです。

...IO クラスの同名メソッドIO#getsと同じです。

但し、gzip ファイル中に
エラーがあった場合 Zlib::Error 例外や
Zlib::GzipFile::Error 例外が発生します。

gzip ファイルのフッターの処理に注意して下さい。
gzip ファイルのフッターに...
...* EOF (圧縮データの最後) を越えて読み込み要求を受けた時。
すなわち Zlib::GzipReader#read,
Zlib::GzipReader#gets メソッド等が nil を返す時。
* EOF まで読み込んだ後、Zlib::GzipFile#close メソッドが
呼び出された時。
* EOF...
...を参照

require 'zlib'

=begin
# hoge.gz がない場合は下記で作成できる。
Zlib::GzipWriter.open('hoge.gz') { |gz|
gz.puts 'hoge'
gz.puts 'fuga'
}
=end

Zlib::GzipReader.open('hoge.gz') { |gz|
while l = gz.gets
puts l
end
}
#=> hoge
#=> fuga...

ARGF.class#gets(limit) -> String | nil (18146.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...GF.gets # => "line1\n"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("e...
...") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

ARGF.class#gets(limit, chomp: false) -> String | nil (18146.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...GF.gets # => "line1\n"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("e...
...") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/) -> String | nil (18146.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...GF.gets # => "line1\n"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("e...
...") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs = $/, chomp: false) -> String | nil (18146.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...GF.gets # => "line1\n"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("e...
...") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs, limit) -> String | nil (18146.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...GF.gets # => "line1\n"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("e...
...") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

ARGF.class#gets(rs, limit, chomp: false) -> String | nil (18146.0)

ARGFの現在位置から一行ずつ文字列として読み込みます。EOF に到達した時に は nil を返します。

...GF.gets # => "line1\n"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets(2) # => "li"

例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("e...
...") # => "line"


例:
# $ echo "line1\nline2\nline3\n\nline4\n" > test.txt
# $ ruby test.rb test.txt

# test.rb
ARGF.gets("") # => "line1\nline2\nline3\n\n"

@see Kernel.#gets, IO#gets, ARGF.class#getbyte, ARGF.class#getc...

絞り込み条件を変える

<< 1 2 3 ... > >>