Skip to content
instance method

Data#eql?

(untyped) -> bool
self.eql?(other) → true or false

Equality check that is used when two items of data are keys of a Hash.

The subtle difference with == is that members are also compared with their eql? method, which might be important in some cases:

Example
Measure = Data.define(:amount, :unit)

Measure[1, 'km'] == Measure[1.0, 'km'] #=> true, they are equal as values
# ...but...
Measure[1, 'km'].eql? Measure[1.0, 'km'] #=> false, they represent different hash keys

See also Object#eql? for further explanations of the method usage.