Class: Gitcopier::DirTreeNode
- Inherits:
-
Object
- Object
- Gitcopier::DirTreeNode
- Defined in:
- lib/gitcopier/dir_tree.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#path ⇒ Object
Returns the value of attribute path.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#add_child(name, path) ⇒ Object
add or replace a child with given name and path.
- #get_child(name) ⇒ Object
-
#initialize(path) ⇒ DirTreeNode
constructor
A new instance of DirTreeNode.
Constructor Details
#initialize(path) ⇒ DirTreeNode
Returns a new instance of DirTreeNode.
49 50 51 52 53 |
# File 'lib/gitcopier/dir_tree.rb', line 49 def initialize(path) @path = path @type = path.end_with?('/') ? 'dir' : 'file' @children = {} end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
47 48 49 |
# File 'lib/gitcopier/dir_tree.rb', line 47 def children @children end |
#path ⇒ Object
Returns the value of attribute path.
47 48 49 |
# File 'lib/gitcopier/dir_tree.rb', line 47 def path @path end |
#type ⇒ Object
Returns the value of attribute type.
47 48 49 |
# File 'lib/gitcopier/dir_tree.rb', line 47 def type @type end |
Instance Method Details
#add_child(name, path) ⇒ Object
add or replace a child with given name and path
60 61 62 63 64 |
# File 'lib/gitcopier/dir_tree.rb', line 60 def add_child(name, path) child = DirTreeNode.new(path) @children[name] = child return child end |
#get_child(name) ⇒ Object
55 56 57 |
# File 'lib/gitcopier/dir_tree.rb', line 55 def get_child(name) @children[name] end |