Sha256: 4a55b09d72affddf06e5d5516ff5e0e4193032cffe00eb50a6d02a7ce2342f71
Contents?: true
Size: 689 Bytes
Versions: 3
Compression:
Stored size: 689 Bytes
Contents
module Rambling module Trie # Provides enumerable behavior to the trie data structure. module Enumerable include ::Enumerable # Returns number of words contained in the trie. See # {https://ruby-doc.org/core-2.4.0/Enumerable.html#method-i-count # Enumerable} alias_method :size, :count # Iterates over the words contained in the trie. # @yield [String] the words contained in this trie node. def each return enum_for :each unless block_given? yield as_word if terminal? children.each do |child| child.each do |word| yield word end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rambling-trie-1.0.2 | lib/rambling/trie/enumerable.rb |
rambling-trie-1.0.1 | lib/rambling/trie/enumerable.rb |
rambling-trie-1.0.0 | lib/rambling/trie/enumerable.rb |