class Integer
class Integer
¶ ↑
The same as {Numeric#>} and {Numeric#<}. See them for the background.
Public Instance Methods
<(c)
click to toggle source
Special case for comparison with a {RangeExtd::Infinity} instance.
# File lib/range_extd/numeric.rb, line 149 def <(c) # Default if self is not comparable (in case the Integer method is redifined by a user). return less_than_integer_before_infinity?(c) if !self.class.method_defined?(:>) if RangeExtd::Infinity.infinity? c c.positive? else less_than_integer_before_infinity?(c) end end
Also aliased as: less_than_integer_before_infinity?
<=>(c)
click to toggle source
Special case for comparison with a {RangeExtd::Infinity} instance.
# File lib/range_extd/numeric.rb, line 124 def <=>(c) # Default if the special case INFINITY (never happens in Default, but a user may define Integer::INFINITY). return compare_than_integer_before_infinity?(c) if ((abs rescue self) == Float::INFINITY) return (-(c.send(__method__, self) || return)) if RangeExtd::Infinity.infinity? c compare_than_integer_before_infinity?(c) end
Also aliased as: compare_than_integer_before_infinity?
>(c)
click to toggle source
Special case for comparison with a {RangeExtd::Infinity} instance.
# File lib/range_extd/numeric.rb, line 135 def >(c) # Default if self is not comparable (in case the Integer method is redifined by a user). return greater_than_integer_before_infinity?(c) if !self.class.method_defined?(:>) if RangeExtd::Infinity.infinity? c c.negative? else greater_than_integer_before_infinity?(c) end end
Also aliased as: greater_than_integer_before_infinity?