ライブラリ
- ビルトイン (348)
-
irb
/ input-method (12) - rake (12)
- tempfile (36)
- zlib (24)
クラス
-
ARGF
. class (24) - IO (324)
-
IRB
:: FileInputMethod (12) - Tempfile (36)
-
Zlib
:: GzipReader (24)
モジュール
- Kernel (12)
検索結果
先頭5件
-
Kernel
# file(*args) { . . . } -> Rake :: FileTask (24421.0) -
ファイルタスクを定義します。
...ル名と依存ファイル名を指定します。
例:
file "config.cfg" => ["config.template"] do
open("config.cfg", "w") do |outfile|
open("config.template") do |infile|
while line = infile.gets
outfile.puts line
end
end
end
end
@see R... -
IRB
:: FileInputMethod # gets -> String (24102.0) -
読み込んだファイルから文字列を 1 行読み込みます。
読み込んだファイルから文字列を 1 行読み込みます。 -
IO
# gets(limit) -> String | nil (18140.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> n... -
IO
# gets(limit , chomp: false) -> String | nil (18140.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> n... -
IO
# gets(rs = $ / ) -> String | nil (18140.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> n... -
IO
# gets(rs = $ / , chomp: false) -> String | nil (18140.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> n... -
IO
# gets(rs , limit) -> String | nil (18140.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> n... -
IO
# gets(rs , limit , chomp: false) -> String | nil (18140.0) -
一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。
...み用にオープンされていなければ発生します。
f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets #=> nil
$_ #=> n... -
Tempfile
# delete -> self (6007.0) -
テンポラリファイルをクローズせずに、削除します。 UNIXライクなシステムでは、 作成したテンポラリファイルが他のプログラムに使用される機会をなくすために、 テンポラリファイルを作成しオープンした後、 すぐに削除するということがしばしばおこなわれます。
...ンポラリファイルを作成しオープンした後、
すぐに削除するということがしばしばおこなわれます。
require "tempfile"
tf = Tempfile.new("foo")
tf.unlink
p tf.path # => nil
tf.print("foobar,hoge\n")
tf.rewind
p tf.gets("\n") # => "foobar,hoge\n"... -
Tempfile
# open -> self (6007.0) -
クローズしたテンポラリファイルを再オープンします。 "r+" でオープンされるので、クローズ前の内容を再度読む ことができます。
...ァイルを再オープンします。
"r+" でオープンされるので、クローズ前の内容を再度読む
ことができます。
require "tempfile"
tf = Tempfile.new("foo")
tf.print("foobar,hoge\n")
tf.print("bar,ugo\n")
tf.close
tf.open
p tf.gets # => "foobar,hoge\n"... -
Tempfile
# unlink -> self (6007.0) -
テンポラリファイルをクローズせずに、削除します。 UNIXライクなシステムでは、 作成したテンポラリファイルが他のプログラムに使用される機会をなくすために、 テンポラリファイルを作成しオープンした後、 すぐに削除するということがしばしばおこなわれます。
...ンポラリファイルを作成しオープンした後、
すぐに削除するということがしばしばおこなわれます。
require "tempfile"
tf = Tempfile.new("foo")
tf.unlink
p tf.path # => nil
tf.print("foobar,hoge\n")
tf.rewind
p tf.gets("\n") # => "foobar,hoge\n"... -
IO
# readlines(limit , chomp: false) -> [String] (67.0) -
データを全て読み込んで、その各行を要素としてもつ配列を返します。 既に EOF に達していれば空配列 [] を返します。
...uby]{
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) } # => ["lin", "e1,", "\n", "lin", "e2,", "\n", "lin", "e3,", "\n"]
File.open("testfile") { |f| p f.readlin......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...