module SyntaxTree::ArrayMatch

When we’re implementing the === operator for a node, we oftentimes need to compare two arrays. We want to skip over the === definition of array and use our own here, so we do that using this module.

Public Class Methods

call(left, right) click to toggle source
# File lib/syntax_tree/node.rb, line 158
def self.call(left, right)
  left.length === right.length &&
    left
      .zip(right)
      .all? { |left_value, right_value| left_value === right_value }
end