Module: SyntaxTree::ArrayMatch
- Defined in:
- lib/syntax_tree/node.rb
Overview
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.
Class Method Summary collapse
Class Method Details
.call(left, right) ⇒ Object
158 159 160 161 162 163 |
# 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 |