Class: ACLS::Tree
- Inherits:
-
Object
- Object
- ACLS::Tree
- Defined in:
- lib/acls/tree.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#directory ⇒ Object
Returns the value of attribute directory.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(parent, name, directory, source = nil) ⇒ Tree
constructor
A new instance of Tree.
- #make_child(name, directory, source = nil) ⇒ Object
- #path ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(parent, name, directory, source = nil) ⇒ Tree
5 6 7 8 9 10 11 |
# File 'lib/acls/tree.rb', line 5 def initialize(parent, name, directory, source=nil) @parent = parent @name = name @directory = directory @source = source @children = [] end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
3 4 5 |
# File 'lib/acls/tree.rb', line 3 def children @children end |
#directory ⇒ Object
Returns the value of attribute directory.
3 4 5 |
# File 'lib/acls/tree.rb', line 3 def directory @directory end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/acls/tree.rb', line 3 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/acls/tree.rb', line 3 def parent @parent end |
#source ⇒ Object
Returns the value of attribute source.
3 4 5 |
# File 'lib/acls/tree.rb', line 3 def source @source end |
Instance Method Details
#make_child(name, directory, source = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/acls/tree.rb', line 13 def make_child(name, directory, source=nil) child = Tree.new(self, name, directory, source) @children << child child end |
#path ⇒ Object
19 20 21 |
# File 'lib/acls/tree.rb', line 19 def path @source || @directory end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/acls/tree.rb', line 23 def to_s "name: #{@name}, source: #{@source}, directory: #{@directory}, parent: #{@parent}, children: #{@children.length}" end |