Module: Jinx::PartialOrder
- Includes:
- Comparable
- Defined in:
- lib/jinx/helpers/partial_order.rb
Overview
A PartialOrder is a Comparable with restricted scope. Classes which include PartialOrder are required to implement the <=> operator with the following semantics:
- If if a and b are comparable, then return the value of the comparison.
- Otherwise, return nil. A PartialOrder thus relaxes comparison symmetry, e.g.: a < b does not imply: b >= a.
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
(also: #==)
True if other is an instance of this object's class and other == self, false otherwise.
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
Returns true if other is an instance of this object's class and other == self, false otherwise.
39 40 41 |
# File 'lib/jinx/helpers/partial_order.rb', line 39 def eql?(other) self.class === other and super end |