| Module | Comparable |
| In: |
lib/core/facets/comparable/op_get.rb
lib/core/facets/comparable/cmp.rb lib/core/facets/comparable/cap.rb lib/core/facets/comparable/clip.rb |
Automatically generate comparitive definitions based on attribute fields.
include Comparable[:a, :b]
is equivalent to including a module containing:
def <=>(other)
cmp = self.a <=> other.a; return cmp unless cmp == 0
cmp = self.b <=> other.b; return cmp unless cmp == 0
0
end