Class: FileTree

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

Constant Summary collapse

VERSION =
"1.0.0"

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.



14
15
16
# File 'lib/filetree.rb', line 14

def id
  @id
end

#identifierObject

Returns the value of attribute identifier.



14
15
16
# File 'lib/filetree.rb', line 14

def identifier
  @identifier
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/filetree.rb', line 14

def name
  @name
end

Instance Method Details

#children(*args) ⇒ Array

Returns:

  • (Array)

    an Array of all entries contained in self.



42
43
44
45
46
47
48
# File 'lib/filetree.rb', line 42

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

#join(*args) ⇒ Object

Joins the given pathnames onto self to create a new FileTree object.



52
53
54
# File 'lib/filetree.rb', line 52

def join(*args)
  FileTree.new(super(*args))
end

#parentFileTree

Returns:

  • (FileTree)

    The directory immediately above self.



33
34
35
# File 'lib/filetree.rb', line 33

def parent
  FileTree.new(_parent)
end