class FakeFS::FakeFile
Fake file class
Attributes
atime[RW]
birthtime[RW]
ctime[RW]
gid[RW]
inode[RW]
mode[RW]
mtime[RW]
name[RW]
parent[RW]
uid[RW]
Public Class Methods
new(name = nil, parent = nil)
click to toggle source
# File lib/fakefs/fake/file.rb, line 8 def initialize(name = nil, parent = nil) @name = name @parent = parent @inode = FakeInode.new(self) @ctime = Time.now @mtime = @ctime @atime = @ctime @birthtime = @ctime @mode = 0o100000 + (0o666 - File.umask) @uid = Process.uid @gid = Process.gid end
Public Instance Methods
clone(parent = nil)
click to toggle source
Calls superclass method
# File lib/fakefs/fake/file.rb, line 37 def clone(parent = nil) clone = super() clone.parent = parent if parent clone.inode = inode.clone clone end
content()
click to toggle source
# File lib/fakefs/fake/file.rb, line 21 def content @inode.content end
content=(str)
click to toggle source
# File lib/fakefs/fake/file.rb, line 25 def content=(str) @inode.content = str end
delete()
click to toggle source
# File lib/fakefs/fake/file.rb, line 57 def delete inode.unlink(self) inode.free_inode_num parent.delete(self) end
entry()
click to toggle source
# File lib/fakefs/fake/file.rb, line 44 def entry self end
inspect()
click to toggle source
# File lib/fakefs/fake/file.rb, line 48 def inspect "(FakeFile name:#{name.inspect} " \ "parent:#{parent.to_s.inspect} size:#{content.size})" end
link(other_file)
click to toggle source
# File lib/fakefs/fake/file.rb, line 33 def link(other_file) @inode.link(other_file) end
links()
click to toggle source
# File lib/fakefs/fake/file.rb, line 29 def links @inode.links end
to_s()
click to toggle source
# File lib/fakefs/fake/file.rb, line 53 def to_s File.join(parent.to_s, name) end