Class: Array

Inherits:
Object show all
Defined in:
lib/like_structure/extensions.rb

Instance Method Summary collapse

Instance Method Details

#reverse_like?(actual) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
# File 'lib/like_structure/extensions.rb', line 12

def reverse_like?(actual)
  return false unless actual.kind_of?(Array) && actual.size == self.size
  [actual, self].transpose.each do |actual_item, expected_item|
    return false unless actual_item.like?(expected_item)
  end
  true
end