module Rambling::Trie::Compressible

Provides the compressible behavior for the trie data structure.

Public Instance Methods

compressible?() click to toggle source

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.
# File lib/rambling/trie/compressible.rb, line 11
def compressible?
  !(root? || terminal?) && 1 == children_tree.size
end