Sha256: e952729954c1ce88c8bb864ecf6acbff9cb2c3f2d5a7ff49cdd54a07135460c1

Contents?: true

Size: 576 Bytes

Versions: 2

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

module Rambling
  module Trie
    # Provides the comparable behavior for the trie data structure.
    module Comparable
      # Compares two nodes.
      # @param [Nodes::Node] other the node to compare against.
      # @return [Boolean] +true+ if the nodes' {Nodes::Node#letter #letter} and
      #   {Nodes::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

2 entries across 2 versions & 1 rubygems

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