luislavena / radix

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

Allow insert paths with shared keys unordered #10

Closed luislavena closed 8 years ago

luislavena commented 8 years ago

When adding new nodes into the tree, the lookup mechanism failed to detect same named parameter was already added to it, raising an exception.

Example:

tree = Radix::Tree(Symbol).new
tree.add "/members/:id/edit", :member_edit
tree.add "/members/export",   :members_export
tree.add "/members/:id/videos", :member_videos # Exception

This fix ensures that comparison is done key by key, even if they are inserted into the tree in a different order.

Closes #9