Sha256: da303fa060db309aa6e9c6993632cec9a61152c1fe91234bebada0a6ce4941ac

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

module Rambling
  module Trie
    # Provides the comparable behavior for the trie data structure.
    module Comparable
      # Compares two nodes.
      # @param [Node] other the node to compare against.
      # @return [Boolean] `true` if the nodes' {Node#letter #letter} and
      #   {Node#children_tree #children_tree} are equal, `false` otherwise.
      def == other
        letter == other.letter &&
          terminal? == other.terminal? &&
          children_tree == other.children_tree
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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