Module: Fr::SZipper
- Defined in:
- lib/fr/szipper.rb,
lib/fr/szipper/node.rb,
lib/fr/szipper/enumerable.rb,
lib/fr/szipper/head_cursor.rb,
lib/fr/szipper/edited_cursor.rb,
lib/fr/szipper/abstract_cursor.rb,
lib/fr/szipper/memoized_cursor.rb,
lib/fr/szipper/head_prev_cursor.rb,
lib/fr/szipper/tail_next_cursor.rb
Defined Under Namespace
Modules: Enumerable Classes: AbstractCursor, EditedCursor, HeadCursor, HeadPrevCursor, MemoizedCursor, Node, TailNextCursor
Class Method Summary collapse
-
.build(node = nil) ⇒ Object
Constructors a zipper for traversing the given tree or subtree.
Class Method Details
.build(node = nil) ⇒ Object
Constructors a zipper for traversing the given tree or subtree. The ‘node` value can be any structure where
node#next
the next node
node#last?
true if no nodes are allowed to be inserted
node#copy(next: ...)
creates a new node with the given next node
27 28 29 30 31 32 33 |
# File 'lib/fr/szipper.rb', line 27 def build(node = nil) if node Fr::SZipper::HeadCursor.new(node) else Fr::SZipper::HeadPrevCursor.new(nil) end end |