Class: TestFs::RootDirectory

Inherits:
Directory show all
Defined in:
lib/test_fs/root_directory.rb

Overview

RootDirectory

Represents the root of the filesystem

Instance Attribute Summary

Attributes inherited from Directory

#nodes

Instance Method Summary collapse

Methods inherited from Directory

#create!, #dir, #file

Constructor Details

#initializeRootDirectory

Returns a new instance of RootDirectory.



9
10
11
# File 'lib/test_fs/root_directory.rb', line 9

def initialize
  @nodes = []
end

Instance Method Details

#destroy!Object

TODO: clear lists & value for root? Recursively destroy the root filesystem



22
23
24
# File 'lib/test_fs/root_directory.rb', line 22

def destroy!
  FileUtils.rm_rf(self.path)
end

#pathObject

Retrieve the path for the generated root directory



15
16
17
# File 'lib/test_fs/root_directory.rb', line 15

def path
  "#{Dir.tmpdir}/#{name}"
end