new

File.new(filename, mode="r" [, opt]) â file
File.new(filename [, mode [, perm]] [, opt]) â file
Class Public methods

Opens the file named by filename according to the given mode and returns a new File object.

See IO.new for a description of mode and opt.

If a file is being created, permission bits may be given in perm. These mode and permission bits are platform dependent; on Unix systems, see open(2) and chmod(2) man pages for details.

Examples

f = File.new("testfile", "r")
f = File.new("newfile",  "w+")
f = File.new("newfile", File::CREAT|File::TRUNC|File::RDWR, 0644)
doc_ruby_on_rails
2015-04-06 11:04:07
Comments
Leave a Comment

Please login to continue.