Class: SortableElementForNestedSet::TreeNode

Inherits:
Object
  • Object
show all
Defined in:
lib/tree_calc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childrenObject

Returns the value of attribute children.



122
123
124
# File 'lib/tree_calc.rb', line 122

def children
  @children
end

#idObject

Returns the value of attribute id.



122
123
124
# File 'lib/tree_calc.rb', line 122

def id
  @id
end

#leftObject

Returns the value of attribute left.



123
124
125
# File 'lib/tree_calc.rb', line 123

def left
  @left
end

#parent_idObject

Returns the value of attribute parent_id.



122
123
124
# File 'lib/tree_calc.rb', line 122

def parent_id
  @parent_id
end

#rightObject

Returns the value of attribute right.



123
124
125
# File 'lib/tree_calc.rb', line 123

def right
  @right
end