Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > ARGFオブジェクト > to_s

singleton method ARGF.to_s

to_s -> String

常に文字列 "ARGF" を返します。

# カレントディレクトリから適当にファイルを選ぶ
ARGV.replace(
  Dir.glob("*").reject{|name| FileTest.file?(name) == false}
)
while line = ARGF.gets
  p [ARGF.filename, ARGF.to_s, ARGV]
  ARGF.skip
end

#例
#=> ["test.rb", "ARGF", ["test.rb~", "third.txt", "ugo.yaml"]]
#=> ["test.rb~", "ARGF", ["third.txt", "ugo.yaml"]]
#...
object ARGF