Class: SortableElementForNestedSet::TreeNode
- Inherits:
-
Object
- Object
- SortableElementForNestedSet::TreeNode
- Defined in:
- lib/tree_calc.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#id ⇒ Object
Returns the value of attribute id.
-
#left ⇒ Object
Returns the value of attribute left.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#right ⇒ Object
Returns the value of attribute right.
Instance Method Summary collapse
-
#initialize(id, children = nil) ⇒ TreeNode
constructor
A new instance of TreeNode.
Constructor Details
#initialize(id, children = nil) ⇒ TreeNode
Returns a new instance of TreeNode.
125 126 127 128 |
# File 'lib/tree_calc.rb', line 125 def initialize(id, children = nil) @id = id @children = children.nil? ? [] : children end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
122 123 124 |
# File 'lib/tree_calc.rb', line 122 def children @children end |
#id ⇒ Object
Returns the value of attribute id.
122 123 124 |
# File 'lib/tree_calc.rb', line 122 def id @id end |
#left ⇒ Object
Returns the value of attribute left.
123 124 125 |
# File 'lib/tree_calc.rb', line 123 def left @left end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
122 123 124 |
# File 'lib/tree_calc.rb', line 122 def parent_id @parent_id end |
#right ⇒ Object
Returns the value of attribute right.
123 124 125 |
# File 'lib/tree_calc.rb', line 123 def right @right end |