APIdock / Ruby
/
method

foreach

ruby latest stable - Class: Shell ::CommandProcessor
foreach(path = nil, *rs)
public

See IO.foreach when path is a file.

See Dir.foreach when path is a directory.

# File lib/shell/command-processor.rb, line 92
 def foreach(path = nil, *rs)
 path = "." unless path
 path = expand_path(path)
 if File.directory?(path)
 Dir.foreach(path){|fn| yield fn}
 else
 IO.foreach(path, *rs){|l| yield l}
 end
 end

AltStyle によって変換されたページ (->オリジナル) /