require 'infinite_time/version'
require 'infinite_time/core_ext'

class InfiniteTime < Time
  def initialize sign = :+
    sign = sign.to_sym
    raise InvalidSign unless [:+, :-].include? sign
    @sign = sign
  end

  def positive?
    @sign == :+
  end

  def negative?
    !positive?
  end

  def <=> other
    case other
    when InfiniteTime
      if positive? && other.negative?
        1
      elsif negative? && other.positive?
        -1
      else
        0
      end
    when Time then (@sign == :+) ? 1 : -1
    else raise TypeError
    end
  end

  def + _; self; end
  def - _; self; end

  protected

  def sign; @sign; end

  class InvalidSign < StandardError; end
end

require 'infinite_time/version'
require 'infinite_time/core_ext'

class InfiniteTime < Time
  def initialize sign = :+
    sign = sign.to_sym
    raise InvalidSign unless [:+, :-].include? sign
    @sign = sign
  end

  def positive?
    @sign == :+
  end

  def negative?
    !positive?
  end

  def <=> other
    case other
    when InfiniteTime
      if positive? && other.negative?
        1
      elsif negative? && other.positive?
        -1
      else
        0
      end
    when Time then (positive?) ? 1 : -1
    else raise TypeError
    end
  end

  def + _; self; end
  def - _; self; end

  protected

  def sign; @sign; end

  class InvalidSign < StandardError; end
end

Use existing method to determine sign instead of reimplementing
Use existing method to determine sign instead of reimplementing
