Sha256: 043277c3c73d6269df16308555baf2aecefa15a274f1c57b239696c53ce03595
Contents?: true
Size: 737 Bytes
Versions: 7
Compression:
Stored size: 737 Bytes
Contents
# frozen_string_literal: true 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.5.0/Enumerable.html#method-i-count # Enumerable#count 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_tree.each_value do |child| child.each do |word| yield word end end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems