The Rambling Trie has reached its 0.4.2 version. This one includes the before mentioned changes for the trie instance to behave as an Enumerable
.
This means that having this:
trie = Rambling::Trie.create
(%w(some words and other stuff)).each |word|
trie << word
end
You can do something like this:
trie.each do |word|
puts "#{word} is included!"
end
As well as:
trie.any? { |word| word.include? 'x' }
trie.all? { |word| word.length > 0 }
And any other method included in Ruby core's Enumerable
module.
Isn't that cool!?
Enjoy!