Sha256: 2fd080730189422fdb8f2a9c5e1fb1859ad58189a26ea849854878a8198f2aa8

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rambling-trie-1.0.2 lib/rambling/trie/compressable.rb
rambling-trie-1.0.1 lib/rambling/trie/compressable.rb
rambling-trie-1.0.0 lib/rambling/trie/compressable.rb