Class: Date::Infinity
Overview
:nodoc:
Instance Method Summary (collapse)
- - (Object) +@
- - (Object) -@
- - (Object) <=>(other)
- - (Object) abs
- - (Object) coerce(other)
- - (Boolean) finite?
- - (Boolean) infinite?
-
- (Infinity) initialize(d = 1)
constructor
A new instance of Infinity.
- - (Boolean) nan?
- - (Boolean) zero?
Methods inherited from Numeric
Constructor Details
- (Infinity) initialize(d = 1)
A new instance of Infinity
259 |
# File 'lib/date.rb', line 259 def initialize(d=1) @d = d <=> 0 end |
Instance Method Details
- (Object) +@
273 |
# File 'lib/date.rb', line 273 def +@ () self.class.new(+d) end |
- (Object) -@
272 |
# File 'lib/date.rb', line 272 def -@ () self.class.new(-d) end |
- (Object) <=>(other)
275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/date.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 |
- (Object) abs
270 |
# File 'lib/date.rb', line 270 def abs() self.class.new end |
- (Object) coerce(other)
289 290 291 292 293 294 295 |
# File 'lib/date.rb', line 289 def coerce(other) case other when Numeric; return -d, d else super end end |
- (Boolean) finite?
266 |
# File 'lib/date.rb', line 266 def finite? () false end |
- (Boolean) infinite?
267 |
# File 'lib/date.rb', line 267 def infinite? () d.nonzero? end |
- (Boolean) nan?
268 |
# File 'lib/date.rb', line 268 def nan? () d.zero? end |
- (Boolean) zero?
265 |
# File 'lib/date.rb', line 265 def zero? () false end |