Method: Shell::CommandProcessor#foreach
- Defined in:
- lib/shell/command-processor.rb
#foreach(path = nil, *rs) ⇒ Object
call-seq:
foreach(path, record_separator) -> Enumerator
foreach(path, record_separator) { block }
See IO.foreach when path is a file.
See Dir.foreach when path is a directory.
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/shell/command-processor.rb', line 92 def foreach(path = nil, *rs) path = "." unless path path = (path) if File.directory?(path) Dir.foreach(path){|fn| yield fn} else IO.foreach(path, *rs){|l| yield l} end end |