Remove Radix::Result#key usage in the codebase

No longer expose internal functionality used only in tests. Reduce the
exposed elements of `Radix::Result` to focus on payload only.

Also remove the associated array used to collect all the traversed nodes
when performing the lookup.

NOTE: this is a breaking change
This commit is contained in:
Luis Lavena 2021-01-30 20:15:47 -03:00
parent 09a334a53d
commit 3d0e8de952
4 changed files with 14 additions and 89 deletions

View file

@ -21,37 +21,6 @@ module Radix
end
end
describe "#key" do
context "a new instance" do
it "returns an empty key" do
result = Result(Nil).new
result.key.should eq("")
end
end
context "given one used node" do
it "returns the node key" do
node = Node(Symbol).new("/", :root)
result = Result(Symbol).new
result.use node
result.key.should eq("/")
end
end
context "using multiple nodes" do
it "combines the node keys" do
node1 = Node(Symbol).new("/", :root)
node2 = Node(Symbol).new("about", :about)
result = Result(Symbol).new
result.use node1
result.use node2
result.key.should eq("/about")
end
end
end
describe "#use" do
it "uses the node payload" do
node = Node(Symbol).new("/", :root)