クラス
-
ARGF
. class (121) - IO (561)
- Object (22)
キーワード
-
$ -0 (11) -
$ / (11) -
$ _ (11) -
$ stdin (11) - ARGF (22)
- DATA (11)
- IO (11)
- SizedQueue (9)
- autoclose= (11)
- each (66)
-
each
_ line (66) - getbyte (11)
- getc (11)
- getsid (11)
- lineno (11)
- lineno= (11)
- loop (22)
- pipe (88)
- popen (154)
- pos (22)
- pos= (22)
- readline (77)
- readlines (44)
- readpartial (11)
- sysread (11)
- tell (22)
検索結果
先頭5件
-
ARGF
. class # gets(limit) -> String | nil (26141.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 (26141.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 (26141.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 (26141.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 (26141.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 (26141.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... -
Kernel
. # gets(rs = $ / ) -> String | nil (26139.0) -
ARGFから一行読み込んで、それを返します。 行の区切りは引数 rs で指定した文字列になります。
...t[main.rb][ruby]{
ARGV << 'b.txt' << 'c.txt'
p gets #=> "hello\n"
p gets(nil) #=> "it\ncommon\n"
p gets("") #=> "ARGF\n\n"
p gets('、') #=> "# スクリプトに指定した引数 (Object::ARGV を参照) をファイル名と\n# みなして、"
p gets #=> "それらのファイルを連結した......1 つの仮想ファイルを表すオブジェクトです。\n"
p gets #=> nil
p readline # end of file reached (EOFError)
//}
//emlist[b.txt][ruby]{
hello
it
common
//}
//emlist[c.txt][ruby]{
ARGF
# スクリプトに指定した引数 (Object::ARGV を参照) をファイル名と
# みなし... -
IO
# gets(limit) -> String | nil (26117.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...プンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil
@see $/, IO... -
IO
# gets(limit , chomp: false) -> String | nil (26117.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...プンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil
@see $/, IO... -
IO
# gets(rs = $ / ) -> String | nil (26117.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...プンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil
@see $/, IO... -
IO
# gets(rs = $ / , chomp: false) -> String | nil (26117.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...プンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil
@see $/, IO... -
IO
# gets(rs , limit) -> String | nil (26117.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...プンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil
@see $/, IO... -
IO
# gets(rs , limit , chomp: false) -> String | nil (26117.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...プンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> nil
@see $/, IO... -
Process
. # getsid(pid = 0) -> Integer (14102.0) -
引数 pid で指定されたプロセスのセッション ID を返します。
...e NotImplementedError メソッドが現在のプラットフォームで実装されて
いない場合に発生します。
Process.getsid() # => 27422
Process.getsid(0) # => 27422
Process.getsid(Process.pid()) # => 27422
@see getsid(2)... -
Object
:: DATA -> File (8050.0) -
スクリプトの __END__ プログラムの終り以降をアクセスする File オブジェクト。
...イル ($0) を指します。
=== 例1
print DATA.gets # => 故人西辞黄鶴楼
print DATA.gets # => 烟花三月下揚州
print DATA.gets # => 孤帆遠影碧空尽
print DATA.gets # => 唯見長江天際流
DATA.gets # => nil
__END__
故人西辞黄鶴楼......d
p DATA.gets # => "sum = 0¥n"
__END__
17
19
23
29
31
=== 例3
DATA.gets # => uninitialized constant DATA (NameError)
=== 例4
ファイル library.rb と app.rb の内容が以下であったとします。
library.rb:
print DATA.gets
__E... -
IO
# lineno -> Integer (8046.0) -
現在の行番号を整数で返します。実際には IO#gets が呼ばれた回数です。 改行以外のセパレータで gets が呼ばれた場合など、実際の行番号と異なる場合があります。
...現在の行番号を整数で返します。実際には IO#gets が呼ばれた回数です。
改行以外のセパレータで gets が呼ばれた場合など、実際の行番号と異なる場合があります。
@raise IOError 読み込み用にオープンされていなければ発生......します。
f = File.new("testfile")
f.lineno #=> 0
f.gets #=> "This is line one\n"
f.lineno #=> 1
f.gets #=> "This is line two\n"
f.lineno #=> 2
@see $....