Sha256: a78637d1c0e8a5aefedbbcc6c215e52d05f12a490e29890493c1a88491a9aadc

Contents?: true

Size: 491 Bytes

Versions: 8

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rambling-trie-2.3.0 lib/rambling/trie/compressible.rb
rambling-trie-2.2.1 lib/rambling/trie/compressible.rb
rambling-trie-2.2.0 lib/rambling/trie/compressible.rb
rambling-trie-opal-2.1.1.1 lib/rambling/trie/compressible.rb
rambling-trie-opal-2.1.1 lib/rambling/trie/compressible.rb
rambling-trie-2.1.1 lib/rambling/trie/compressible.rb
rambling-trie-2.1.0 lib/rambling/trie/compressible.rb
rambling-trie-2.0.0 lib/rambling/trie/compressible.rb