るりまサーチ

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

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file path
  4. file open
  5. file size

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

IRB::FileInputMethod#gets -> String (21101.0)

読み込んだファイルから文字列を 1 行読み込みます。

読み込んだファイルから文字列を 1 行読み込みます。

Kernel#file(*args) { ... } -> Rake::FileTask (18213.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...

Kernel.#gets(rs = $/) -> String | nil (18143.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 (18127.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 (18127.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 (18127.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 (18127.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 (18127.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 (18127.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 (3006.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 (3006.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 (3006.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"...
<< 1 2 3 ... > >>