module Rambling::Trie::Enumerable
Provides enumerable behavior to the trie data structure.
Public Instance Methods
each() { |as_word| ... }
click to toggle source
Iterates over the words contained in the trie. @yield [String] the words contained in this trie node. @return [self]
# File lib/rambling/trie/enumerable.rb, line 17 def each return enum_for :each unless block_given? yield as_word if terminal? children_tree.each_value do |child| child.each do |word| yield word end end self end