- A
- B
- C
- D
- E
- F
- I
- J
- L
- M
- N
- R
- S
- T
- W
- CLASS FakeFS::File::Stat
PATH_SEPARATOR | = | '/' |
MODES | = | [ READ_ONLY = "r", READ_WRITE = "r+", WRITE_ONLY = "w", READ_WRITE_TRUNCATE = "w+", APPEND_WRITE_ONLY = "a", APPEND_READ_WRITE = "a+" ] |
FILE_CREATION_MODES | = | MODES - [READ_ONLY, READ_WRITE] |
MODE_BITMASK | = | RealFile::RDONLY | RealFile::WRONLY | RealFile::RDWR | RealFile::APPEND | RealFile::CREAT | RealFile::EXCL | RealFile::NONBLOCK | RealFile::TRUNC | RealFile::NOCTTY | RealFile::SYNC |
FILE_CREATION_BITMASK | = | RealFile::CREAT |
[R] | path |
Source: show
# File lib/fakefs/file.rb, line 113 def self.basename(*args) RealFile.basename(*args) end
Source: show
# File lib/fakefs/file.rb, line 79 def self.const_missing(name) RealFile.const_get(name) end
Source: show
# File lib/fakefs/file.rb, line 59 def self.ctime(path) if exists?(path) FileSystem.find(path).ctime else raise Errno::ENOENT end end
Source: show
# File lib/fakefs/file.rb, line 159 def self.delete(file_name, *additional_file_names) if !exists?(file_name) raise Errno::ENOENT, "No such file or directory - #{file_name}" end FileUtils.rm(file_name) additional_file_names.each do |file_name| FileUtils.rm(file_name) end additional_file_names.size + 1 end
Source: show
# File lib/fakefs/file.rb, line 83 def self.directory?(path) if path.respond_to? :entry path.entry.is_a? FakeDir else result = FileSystem.find(path) result ? result.entry.is_a?(FakeDir) : false end end
Source: show
# File lib/fakefs/file.rb, line 117 def self.dirname(path) RealFile.dirname(path) end
Source: show
# File lib/fakefs/file.rb, line 39 def self.exist?(path) !!FileSystem.find(path) end
Source: show
# File lib/fakefs/file.rb, line 109 def self.expand_path(*args) RealFile.expand_path(*args) end
Source: show
# File lib/fakefs/file.rb, line 31 def self.extname(path) RealFile.extname(path) end
Source: show
# File lib/fakefs/file.rb, line 100 def self.file?(path) if path.respond_to? :entry path.entry.is_a? FakeFile else result = FileSystem.find(path) result ? result.entry.is_a?(FakeFile) : false end end
Source: show
# File lib/fakefs/file.rb, line 35 def self.join(*parts) parts * PATH_SEPARATOR end
Source: show
# File lib/fakefs/file.rb, line 139 def self.link(source, dest) if directory?(source) raise Errno::EPERM, "Operation not permitted - #{source} or #{dest}" end if !exists?(source) raise Errno::ENOENT, "No such file or directory - #{source} or #{dest}" end if exists?(dest) raise Errno::EEXIST, "File exists - #{source} or #{dest}" end source = FileSystem.find(source) dest = FileSystem.add(dest, source.entry.clone) source.link(dest) 0 end
Source: show
# File lib/fakefs/file.rb, line 185 def self.lstat(file) File::Stat.new(file, true) end
Source: show
# File lib/fakefs/file.rb, line 51 def self.mtime(path) if exists?(path) FileSystem.find(path).mtime else raise Errno::ENOENT end end
Source: show
# File lib/fakefs/file.rb, line 227 def initialize(path, mode = READ_ONLY, perm = nil) @path = path @mode = mode @file = FileSystem.find(path) @autoclose = true check_modes! file_creation_mode? ? create_missing_file : check_file_existence! super(@file.content, mode) end
Source: show
# File lib/fakefs/file.rb, line 126 def self.read(path) file = new(path) if file.exists? file.read else raise Errno::ENOENT end end
Source: show
# File lib/fakefs/file.rb, line 135 def self.readlines(path) read(path).split("\n") end
Source: show
# File lib/fakefs/file.rb, line 121 def self.readlink(path) symlink = FileSystem.find(path) FileSystem.find(symlink.target).to_s end
Source: show
# File lib/fakefs/file.rb, line 67 def self.size(path) read(path).length end
Source: show
# File lib/fakefs/file.rb, line 71 def self.size?(path) if exists?(path) && !size(path).zero? true else nil end end
Source: show
# File lib/fakefs/file.rb, line 181 def self.stat(file) File::Stat.new(file) end
Source: show
# File lib/fakefs/file.rb, line 177 def self.symlink(source, dest) FileUtils.ln_s(source, dest) end
Source: show
# File lib/fakefs/file.rb, line 92 def self.symlink?(path) if path.respond_to? :entry path.is_a? FakeSymlink else FileSystem.find(path).is_a? FakeSymlink end end
Source: show
# File lib/fakefs/file.rb, line 290 def atime raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 335 def autoclose? @autoclose end
Source: show
# File lib/fakefs/file.rb, line 315 def binmode? raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 294 def chmod(mode_int) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 298 def chown(owner_int, group_int) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 319 def close_on_exec=(bool) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 323 def close_on_exec? raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 302 def ctime self.class.ctime(@path) end
Source: show
# File lib/fakefs/file.rb, line 240 def exists? true end
Source: show
# File lib/fakefs/file.rb, line 306 def flock(locking_constant) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 255 def ioctl(integer_cmd, arg) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 267 def lstat self.class.lstat(@path) end
Source: show
# File lib/fakefs/file.rb, line 310 def mtime self.class.mtime(@path) end
Source: show
# File lib/fakefs/file.rb, line 259 def read_nonblock(maxlen, outbuf = nil) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 286 def readpartial(maxlen, outbuf = nil) raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 341 def size File.size(@path) end
Source: show
# File lib/fakefs/file.rb, line 263 def stat self.class.stat(@path) end
Source: show
# File lib/fakefs/file.rb, line 271 def sysseek(position, whence = SEEK_SET) seek(position, whence) pos end
Source: show
# File lib/fakefs/file.rb, line 278 def to_io self end
Source: show
# File lib/fakefs/file.rb, line 327 def to_path raise NotImplementedError end
Source: show
# File lib/fakefs/file.rb, line 282 def write_nonblock(string) raise NotImplementedError end