Comparable
A mix-in allowing for relational operations. Classes including this module must define the basic relational operators <, =, and >. All other relational operators can be derived through use of those definitions.
self == other
Returns TRUE when self and other are equal.
When <=> returns nil, returns nil.
self > other
Returns TRUE when self is greater than other.
When <=> returns nil, throws an ArgumentError exception.
self >= other
Returns TRUE when self is greater than or equal to other.
When <=> returns nil, throws an ArgumentError exception.
self < other
Returns TRUE when self is less than other.
When <=> returns nil, throws an ArgumentError exception.
self <= other
Returns TRUE when self is less than or equal to other.
When <=> returns nil, throws an ArgumentError exception.
between?(min, max)
Returns TRUE when self falls within a range from min to max, inclusive.
When self <=> min or self <=> max returns nil, throws an ArgumentError exception.
Last updated