README.md in rambling-trie-1.0.2 vs README.md in rambling-trie-1.0.3
- old
+ new
@@ -1,18 +1,18 @@
# Rambling Trie
-[![Gem Version][badge_fury_badge]][badge_fury_link] [![Dependency Status][gemnasium_badge]][gemnasium_link] [![Build Status][travis_ci_badge]][travis_ci_link] [![Code Climate][code_climate_badge]][code_climage_link] [![Coverage Status][coveralls_badge]][coveralls_link] [![Documentation Status][inch_ci_badge]][inch_ci_link]
+[![Gem Version][badge_fury_badge]][badge_fury_link] [![Dependency Status][gemnasium_badge]][gemnasium_link] [![Build Status][travis_ci_badge]][travis_ci_link] [![Code Climate][code_climate_badge]][code_climage_link] [![Coverage Status][coveralls_badge]][coveralls_link] [![Documentation Status][inch_ci_badge]][inch_ci_link] [![License][license_badge]][license_link]
The Rambling Trie is a Ruby implementation of the [trie data structure][trie_wiki], which includes compression abilities and is designed to be very fast to traverse.
## Installing the Rambling Trie
### Requirements
You will need:
-* Ruby 2.1.0 or up
+* Ruby 2.2.0 or up
* RubyGems
See [RVM][rvm], [rbenv][rbenv] or [chruby][chruby] for more information on how to manage Ruby versions.
### Installation
@@ -73,10 +73,16 @@
``` ruby
trie.add 'word'
trie << 'word'
```
+Or if you have multiple words to add, you can use `#concat`:
+
+``` ruby
+trie.concat %w(a collection of words)
+```
+
And to find out if a word already exists in the trie, use `#word?` or its alias `#include?`:
``` ruby
trie.word? 'word'
trie.include? 'word'
@@ -119,19 +125,26 @@
```
This will reduce the size of the trie by using redundant node elimination (redundant nodes are the only-child non-terminal nodes).
> _**Note**: The `#compress!` method acts over the trie instance it belongs to
-> and is destructive. Also, adding words after compression (with `#add` or
+> and replaces the root `Node`. Also, adding words after compression (with `#add` or
> `#<<`) is not supported._
-You can find out if a trie instance is compressed by calling the `#compressed?` method:
+If you want, you can also create a new compressed trie and leave the existing one intact. Just use `#compress` instead:
``` ruby
-trie.compressed?
+compressed_trie = trie.compress
```
+You can find out if a trie instance is compressed by calling the `#compressed?` method. From the `#compress` example:
+
+``` ruby
+trie.compressed? # => false
+compressed_trie.compressed? # => true
+```
+
### Enumeration
Starting from version 0.4.2, you can use any `Enumerable` method over a trie instance, and it will iterate over each word contained in the trie. You can now do things like:
``` ruby
@@ -227,10 +240,11 @@
## Compatible Ruby and Rails versions
The Rambling Trie has been tested with the following Ruby versions:
+* 2.5.x
* 2.4.x
* 2.3.x
* 2.2.x
**No longer supported**:
@@ -266,11 +280,13 @@
[gemnasium_badge]: https://gemnasium.com/gonzedge/rambling-trie.svg
[gemnasium_link]: https://gemnasium.com/gonzedge/rambling-trie
[github_user_gonzedge]: https://github.com/gonzedge
[inch_ci_badge]: https://inch-ci.org/github/gonzedge/rambling-trie.svg?branch=master
[inch_ci_link]: https://inch-ci.org/github/gonzedge/rambling-trie
-[marshal]: https://ruby-doc.org/core-2.4.0/Marshal.html
+[license_badge]: https://badges.frapsoft.com/os/mit/mit.svg?v=103
+[license_link]: https://opensource.org/licenses/mit-license.php
+[marshal]: https://ruby-doc.org/core-2.5.0/Marshal.html
[rambling_trie_configuration]: https://github.com/gonzedge/rambling-trie#configuration
[rambling_trie_contributing_guide]: https://github.com/gonzedge/rambling-trie/blob/master/CONTRIBUTING.md
[rambling_trie_plain_text_reader]: https://github.com/gonzedge/rambling-trie/blob/master/lib/rambling/trie/readers/plain_text.rb
[rbenv]: https://github.com/sstephenson/rbenv
[rubydoc]: http://rubydoc.info/gems/rambling-trie
@@ -278,6 +294,6 @@
[rubyzip]: https://github.com/rubyzip/rubyzip
[rvm]: https://rvm.io
[travis_ci_badge]: https://travis-ci.org/gonzedge/rambling-trie.svg
[travis_ci_link]: https://travis-ci.org/gonzedge/rambling-trie
[trie_wiki]: https://en.wikipedia.org/wiki/Trie
-[yaml]: https://ruby-doc.org/stdlib-2.4.0/libdoc/yaml/rdoc/YAML.html
+[yaml]: https://ruby-doc.org/stdlib-2.5.0/libdoc/yaml/rdoc/YAML.html