Fake file class
# File lib/fakefs/fake/file.rb, line 36 def initialize(name = nil, parent = nil) @name = name @parent = parent @inode = Inode.new(self) @ctime = Time.now @mtime = @ctime @atime = @ctime @birthtime = @ctime @mode = 0100000 + (0666 - File.umask) @uid = Process.uid @gid = Process.gid end
# File lib/fakefs/fake/file.rb, line 67 def clone(parent = nil) clone = super() clone.parent = parent if parent clone.inode = inode.clone clone end
# File lib/fakefs/fake/file.rb, line 51 def content @inode.content end
# File lib/fakefs/fake/file.rb, line 55 def content=(str) @inode.content = str end
# File lib/fakefs/fake/file.rb, line 87 def delete inode.unlink(self) parent.delete(self) end
# File lib/fakefs/fake/file.rb, line 74 def entry self end
# File lib/fakefs/fake/file.rb, line 78 def inspect "(FakeFile name:#{name.inspect} " "parent:#{parent.to_s.inspect} size:#{content.size})" end
# File lib/fakefs/fake/file.rb, line 63 def link(other_file) @inode.link(other_file) end
# File lib/fakefs/fake/file.rb, line 59 def links @inode.links end
# File lib/fakefs/fake/file.rb, line 83 def to_s File.join(parent.to_s, name) end