Class: Umwelt::Tree::Trunk

Inherits:
Struct::Trunk
  • Object
show all
Defined in:
lib/umwelt/tree/trunk.rb

Instance Method Summary collapse

Instance Method Details

#childs(id) ⇒ Object



17
18
19
# File 'lib/umwelt/tree/trunk.rb', line 17

def childs(id)
  childs_ids[id].map { |child_id| node(child_id) }
end

#node(id) ⇒ Object



13
14
15
# File 'lib/umwelt/tree/trunk.rb', line 13

def node(id)
  builder.call(index[id])
end

#nodesObject



7
8
9
10
11
# File 'lib/umwelt/tree/trunk.rb', line 7

def nodes
  index
    .values
    .map { |fragment| builder.call(fragment) }
end