summaryrefslogtreecommitdiff
path: root/ruby_2_2/lib/rake/ext/time.rb
blob: d3b8cf9dc10a94282b2f1c697eef92458bb7c875 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#--
# Extensions to time to allow comparisons with early and late time classes.

require 'rake/early_time'
require 'rake/late_time'

class Time # :nodoc: all
  alias rake_original_time_compare :<=>
  def <=>(other)
    if Rake::EarlyTime === other || Rake::LateTime === other
      - other.<=>(self)
    else
      rake_original_time_compare(other)
    end
  end
end