open(path, mode = nil, perm = 0666, &b)
public
See IO.open when path is a
file.
See Dir.open when path is a
directory.
Show source
def open(path, mode = nil, perm = 0666, &b)
path = expand_path(path)
if File.directory?(path)
Dir.open(path, &b)
else
if @shell.umask
f = File.open(path, mode, perm)
File.chmod(perm & ~@shell.umask, path)
if block_given?
f.each(&b)
end
f
else
File.open(path, mode, perm, &b)
end
end
end