Sha256: 88cdee4a3d2d83c9ee74e73ac8538b7518e801dceaaefa1fd4bae49ec80e339e

Contents?: true

Size: 405 Bytes

Versions: 4

Compression:

Stored size: 405 Bytes

Contents

module Rambling
  module Trie
    # Provides the compressing behavior for the Trie data structure.
    module Compression
      # Indicates if the current [Rambling::Trie::Node] can be compressed.
      # @return [Boolean] `true` for non-terminal nodes with one child,
      # `false` otherwise.
      def compressable?
        !(root? || terminal?) && children_tree.size == 1
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rambling-trie-0.9.3 lib/rambling/trie/compression.rb
rambling-trie-0.9.2 lib/rambling/trie/compression.rb
rambling-trie-0.9.1 lib/rambling/trie/compression.rb
rambling-trie-0.9.0 lib/rambling/trie/compression.rb