APIdock / Ruby
/
method

open

ruby latest stable - Class: Shell ::CommandProcessor
open(path, mode = nil, perm = 0666, &b)
public

See IO.open when path is a file.

See Dir.open when path is a directory.

# File lib/shell/command-processor.rb, line 111
 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 & [email protected], path)
 if block_given?
 f.each(&b)
 end
 f
 else
 File.open(path, mode, perm, &b)
 end
 end
 end

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