Sha256: f97b0779d2ff1475774a7a986c0d6ec50d4c0666ae04094fca7aeaf9fbf03add
Contents?: true
Size: 647 Bytes
Versions: 1
Compression:
Stored size: 647 Bytes
Contents
module TodoNext class Tree class Node attr_accessor :text, :parent, :children def initialize(text, parent=nil) @text, @parent = text, parent @children = [] end def terminal? ; false end def example? ; false end def has_children? !children.empty? end def remove_from_parent_children parent.children.delete_if do |child| child==self end end def make_me_a_leaf me_as_leaf = Tree::LI.new(text, parent) idx = parent.children.find_index(self) parent.children[idx] = me_as_leaf end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
todo_next-0.0.2 | lib/todo_next/tree/node.rb |