class Radix::Result(T)
- Radix::Result(T)
- Reference
- Object
Overview
A Result is the comulative output of walking our Radix tree
Radix::Tree
implementation.
It provides helpers to retrieve the information obtained from walking
our tree using Radix::Tree#find
This information can be used to perform actions in case of the path that was looked on the Tree was found.
A Result is also used recursively by Radix::Tree#find
when collecting
extra information like params.
Defined in:
graphlb/data_structures/radix_tree.crInstance Method Summary
-
#found?
Returns whatever a payload was found by
Tree#find
and is part of the result. -
#key
Returns a String built based on the nodes used in the result
- #params
- #payload
- #payload?
-
#use(node : Radix::Node(T), payload = true)
Adjust result information by using the details of the given
Node
.
Instance Method Detail
Returns whatever a payload was found by Tree#find
and is part of
the result.
result = Radix::Result(Symbol).new
result.found?
# => false
root = Radix::Node(Symbol).new("/", :root)
result.use(root)
result.found?
# => true
Returns a String built based on the nodes used in the result
node1 = Radix::Node(Symbol).new("/", :root)
node2 = Radix::Node(Symbol).new("about", :about)
result = Radix::Result(Symbol).new
result.use node1
result.use node2
result.key
# => "/about"
When no node has been used, returns an empty String.
result = Radix::Result(Nil).new
result.key
# => ""