method
foreach
v1_8_7_330 -
Show latest stable
- Class:
Pathname
foreach(*args, &block)public
This method is obsoleted at 1.8.1. Use #each_line or #each_entry.
# File lib/pathname.rb, line 1063
def foreach(*args, &block)
warn "Pathname#foreach is obsoleted. Use each_line or each_entry."
if FileTest.directory? @path
# For polymorphism between Dir.foreach and IO.foreach,
# Pathname#foreach doesn't yield Pathname object.
Dir.foreach(@path, *args, &block)
else
IO.foreach(@path, *args, &block)
end
end Related methods
- Instance methods
- +
- <=>
- ==
- ===
- TO_PATH
- absolute?
- ascend
- atime
- basename
- blockdev?
- chardev?
- chdir
- children
- chmod
- chown
- chroot
- cleanpath
- ctime
- delete
- descend
- dir_foreach
- directory?
- dirname
- each_entry
- each_filename
- each_line
- entries
- eql?
- executable?
- executable_real?
- exist?
- expand_path
- extname
- file?
- find
- fnmatch
- fnmatch?
- foreach
- foreachline
- freeze
- ftype
- grpowned?
- hash
- inspect
- join
- lchmod
- lchown
- link
- lstat
- make_link
- make_symlink
- mkdir
- mkpath
- mountpoint?
- mtime
- open
- opendir
- owned?
- parent
- pipe?
- read
- readable?
- readable_real?
- readlines
- readlink
- realpath
- relative?
- relative_path_from
- rename
- rmdir
- rmtree
- root?
- setgid?
- setuid?
- size
- size?
- socket?
- split
- stat
- sticky?
- sub
- symlink
- symlink?
- sysopen
- taint
- to_s
- truncate
- unlink
- untaint
- utime
- world_readable?
- world_writable?
- writable?
- writable_real?
- zero?
- Class methods
- getwd
- glob
- new
- Private methods
-
add_trailing_separator -
chop_basename -
cleanpath_aggressive -
cleanpath_conservative -
del_trailing_separator -
has_trailing_separator? -
plus -
prepend_prefix -
realpath_rec -
split_names