Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Array#eql?

array.eql? other_array → true or false

Returns true if self and other_array are the same size, and if, for each index i in self, self[i].eql? other_array[i]:

Example
a0 = [:foo, 'bar', 2]
a1 = [:foo, 'bar', 2]
a1.eql?(a0) # => true

Otherwise, returns false.

This method is different from method Array#==, which compares using method Object#==.

See also #empty? #fetch #each_index #fill also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1