Class: Date::Infinity
Overview
Instance Method Summary
collapse
Methods included from Comparable
#<, #<=, #==, #>, #>=, #between?
Methods inherited from Numeric
#div, #divmod, #floor, #integer?, #modulo, #nonzero?, #remainder
Constructor Details
#initialize(d = 1) ⇒ Infinity
Returns a new instance of Infinity.
259
|
# File 'lib/framework/dateOrig.rb', line 259
def initialize(d=1) @d = d <=> 0 end
|
Instance Method Details
#<=>(other) ⇒ Object
def -@ () self.class.new(-d) end
def +@ () self.class.new(+d) end
275
276
277
278
279
280
281
282
283
284
285
286
287
|
# File 'lib/framework/dateOrig.rb', line 275
def <=> (other)
case other
when Infinity; return d <=> other.d
when Numeric; return d
else
begin
l, r = other.coerce(self)
return l <=> r
rescue NoMethodError
end
end
nil
end
|
270
|
# File 'lib/framework/dateOrig.rb', line 270
def abs() self.class.new end
|
#coerce(other) ⇒ Object
289
290
291
292
293
294
295
|
# File 'lib/framework/dateOrig.rb', line 289
def coerce(other)
case other
when Numeric; return -d, d
else
super
end
end
|
#finite? ⇒ Boolean
266
|
# File 'lib/framework/dateOrig.rb', line 266
def finite? () false end
|
#infinite? ⇒ Boolean
267
|
# File 'lib/framework/dateOrig.rb', line 267
def infinite? () d.nonzero? end
|
#nan? ⇒ Boolean
268
|
# File 'lib/framework/dateOrig.rb', line 268
def nan? () d.zero? end
|
#zero? ⇒ Boolean
265
|
# File 'lib/framework/dateOrig.rb', line 265
def zero? () false end
|