Module: InfiniteTime::TimeExtension

Included in:
Time
Defined in:
lib/infinite_time/time_extension.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/infinite_time/time_extension.rb', line 7

def <=> other
  if other.infinite?
    (other.positive?) ? -1 : 1
  else
    super
  end
end

#infinite?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/infinite_time/time_extension.rb', line 3

def infinite?
  is_a? InfiniteTime
end