class FakeFS::FakeDir

Attributes

name[RW]
parent[RW]

Public Class Methods

new(name = nil, parent = nil) click to toggle source
# File lib/fakefs/fake/dir.rb, line 5
def initialize(name = nil, parent = nil)
  @name = name
  @parent = parent
end

Public Instance Methods

clone(parent = nil) click to toggle source
# File lib/fakefs/fake/dir.rb, line 18
def clone(parent = nil)
  clone = Marshal.load(Marshal.dump(self))
  clone.each do |key, value|
    value.parent = clone
  end
  clone.parent = parent if parent
  clone
end
delete(node = self) click to toggle source
Calls superclass method
# File lib/fakefs/fake/dir.rb, line 37
def delete(node = self)
  if node == self
    parent.delete(self)
  else
    super(node.name)
  end
end
entry() click to toggle source
# File lib/fakefs/fake/dir.rb, line 10
def entry
  self
end
inspect() click to toggle source
# File lib/fakefs/fake/dir.rb, line 14
def inspect
  "(FakeDir name:#{name.inspect} parent:#{parent.to_s.inspect} size:#{size})"
end
to_s() click to toggle source
# File lib/fakefs/fake/dir.rb, line 27
def to_s
  if parent && parent.to_s != '.'
    File.join(parent.to_s, name)
  elsif parent && parent.to_s == '.'
    "#{File::PATH_SEPARATOR}#{name}"
  else
    name
  end
end