Sha256: 21bbd13b6a0cdc745fd74c270342e60a7de1cefb468be613533d41d120cbeb14

Contents?: true

Size: 473 Bytes

Versions: 2

Compression:

Stored size: 473 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?) && 1 == children_tree.size
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rambling-trie-2.5.0 lib/rambling/trie/compressible.rb
rambling-trie-2.4.0 lib/rambling/trie/compressible.rb