I am comparing arrays of objects and I have a method that determines whether or not two elements are equivalent. I want to to call this method on each pair of elements from both arrays, is there an elegant way of doing this to find a truth value (i.e true if all elements in each array were equivalent, false otherwise)
this is what I have currently:
c = false
self.children.zip(other.children).each do |s,o|
c = s.equiv o # I need a good way to store this result
break if not c
end
I was hoping I could do something like this:
c = self.children.zip(other.children).each{|s,o| s.equiv o}
Any help would be appreciated.
Well you have Enumerable#all?