luislavena / radix

Radix Tree implementation for Crystal
MIT License
102 stars 14 forks source link

Correct lookup with shared key and glob #30

Closed luislavena closed 3 years ago

luislavena commented 3 years ago

Properly skip nodes and continue lookup when the key to be looked up shares partial elements with others.

With the following scenario:

tree = Radix::Tree(Symbol).new
tree.add "/*glob", :catch_all
tree.add "/resources", :resources
tree.add "/robots.txt", :robots

When attempt to lookup for /reviews, it will now correctly return :catch_all as found.

Fixes #23