Class: FileTree

Inherits:
Pathname show all
Includes:
SimpleTree
Defined in:
lib/filetree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SimpleTree

#ancestors, #descendants, #family, #grandparent, #has_children?, #has_parent?, #height, #is_leaf?, #is_root?, #leaves, #siblings, #tree_rep

Instance Attribute Details

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/filetree.rb', line 12

def id
  @id
end

#identifierObject

Returns the value of attribute identifier.



12
13
14
# File 'lib/filetree.rb', line 12

def identifier
  @identifier
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/filetree.rb', line 12

def name
  @name
end

Instance Method Details

#children(*args) ⇒ Array

Returns:

  • (Array)

    an Array of all entries contained in self.



40
41
42
43
44
45
46
# File 'lib/filetree.rb', line 40

def children(*args)
  if self.directory?
    _children(*args)
  else
    []
  end
end

#parentFileTree

Returns:

  • (FileTree)

    The directory immediately above self.



31
32
33
# File 'lib/filetree.rb', line 31

def parent
  FileTree.new(_parent)
end