Commit graph

9 commits

Author SHA1 Message Date
Luis Lavena
9003075ec7 Introduce types for forward compiler compatiblity
After Crystal 0.15, compiler will require declare the types used
by instance variables on classes.

This require changes to the usage of `Radix::Tree` by introducing
the type of payload elements it will handle:

    # Will only support symbols as payload
    tree = Radix::Tree(Symbol).new
    tree.add "/", :root

    # Error: cannot add node with anything other than Symbol
    tree.add "/meaning-of-life", 42

The changes ensure future compatibility with Crystal and also
enforces a more declarative usage of `Radix::Tree`.

If necessary, you can combine multiple types to ensure a tree
can contain all the wide range of payloads you need:

    tree = Radix::Tree.new(Foo | Bar | Symbol).new
    tree.add "/", :root
    tree.add "/foo", foo_instance

This change includes:

- Tree, Node and Result has been updated to require types.
- Node is capable of have optional payload (from defined type).
- Documentation has been updated to reflect this change.
2016-04-16 16:53:20 -03:00
Luis Lavena
ca41d21294 Remove deprecation on shared named parameters
Deal with named parameters under same level (shared) and raise
proper `SharedKeyError` exception.

This is a non-backward compatible change aims to solve result
mapping issues and tree lookup.

Now README covers this under *Caveats* section and offers an
alternative organization of the paths used on the tree.

To avoid potential issues when using `master` instead of a locked
release, bump the version.
2016-03-10 20:54:34 -03:00
Luis Lavena
2a7a3b77bc Merge pull request #1 from askn/master
Update README.md

[skip ci]
2016-01-24 20:04:41 -03:00
Luis Lavena
63bdc343f4 doc: Correct usage sample styles
Ensure Crystal is used as usage examples blocks covered in README.

[skip ci]
2016-01-24 20:01:31 -03:00
Aşkın Gedik
b33839e5f1 Update README.md 2016-01-25 01:00:30 +02:00
Luis Lavena
cc0f5ca225 doc: Correct typo in documentation link
Build link to documentation incorrectly, which resulted in 404 when
visited.

This commit corrects the issue.

[skip ci]
2016-01-24 19:58:29 -03:00
Luis Lavena
4543af0ae3 doc: Link to documentation (docrystal.org)
Add documentation reference badge to README

[skip ci]
2016-01-24 19:42:34 -03:00
Luis Lavena
f320d9fb1a ci: Add Travis build badge to README
[skip ci]
2016-01-24 19:35:39 -03:00
Luis Lavena
7f348cae8c Extraction: initial import
Extract Radix Tree implementation from `Beryl` project into an
standalone library to facilitate usage by other developers.

- Move `Tree`, `Node` and `Result` into `Radix` namespace
- Clenaup standalone README and describe usage
2016-01-24 19:19:42 -03:00