open(path, mode = nil, perm = 0666, &b)
public
CommandProcessor#open(path, mode)
path: String
mode: String
return: File or Dir
Same as:
File
Dir
mode has an effect only when path is a file
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
f = File.open(path, mode, perm, &b)
end
end
end