class FakeFS::FakeFile

Attributes

content[RW]
ctime[R]
inode[RW]
mtime[RW]
name[RW]
parent[RW]

Public Class Methods

new(name = nil, parent = nil) click to toggle source
# File lib/fakefs/fake/file.rb, line 31
def initialize(name = nil, parent = nil)
  @name   = name
  @parent = parent
  @inode  = Inode.new(self)
  @ctime  = Time.now
  @mtime  = @ctime
end

Public Instance Methods

clone(parent = nil) click to toggle source
# File lib/fakefs/fake/file.rb, line 57
def clone(parent = nil)
  clone = super()
  clone.parent = parent if parent
  clone.inode  = inode.clone
  clone
end
content=(str) click to toggle source
# File lib/fakefs/fake/file.rb, line 45
def content=(str)
  @inode.content = str
end
delete() click to toggle source
# File lib/fakefs/fake/file.rb, line 76
def delete
  inode.unlink(self)
  parent.delete(self)
end
entry() click to toggle source
# File lib/fakefs/fake/file.rb, line 64
def entry
  self
end
inspect() click to toggle source
# File lib/fakefs/fake/file.rb, line 68
def inspect
  "(FakeFile name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{content.size})"
end
to_s() click to toggle source
# File lib/fakefs/fake/file.rb, line 72
def to_s
  File.join(parent.to_s, name)
end