lib/jumoku/builders/extended.rb
# Allows for adding consecutive nodes, each nodes being connected to their previous and
# next neighbours.
#
# You may pass {Branch branches} within the nodes list.
#
#     Tree.new.add_consecutive_nodes!(1, 2, 3, :four, Branch.new(:foo, "bar")).branches
#     # => (1=2, 2=3, 3=:four, :four=:foo, :foo="bar")
#
# @param [Array(nodes)] *a flat array of unique nodes
# @return [Tree] `self`
#
Allows for adding consecutive nodes, each nodes being connected to their previous and
next neighbours.

You may pass {Branch branches} within the nodes list.


Allows for adding consecutive nodes each nodes being connected to their previous and next neighbours . You may pass { Branch branches } within the nodes list .
def add_consecutive_nodes!(*a)
      add_nodes!(a.expand_branches!.create_nodes_pairs_list)
      self
    end
def add_consecutive_nodes! ( * a ) add_nodes! ( a . expand_branches! . create_nodes_pairs_list ) self end
Allows for adding consecutive nodes, each nodes being connected to their previous and
next neighbours.
Allows for adding consecutive nodes each nodes being connected to their previous and next neighbours .
# FIXME: really this may not be as efficient as it could be. # We may get rid of nodes duplication (no expand_branches!) # and add nodes by pair, shifting one node at a time from the list.
None
Tree
a
<not_specific>
<not_specific>
a flat array of unique nodes
a flat array of unique nodes