blob: 9549ba32844b171de315a32e54468b5c0d3c612f (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 | class Version
  NULL = Class.new do
    include Comparable
    def <=>(_other)
      -1
    end
    def eql?(_other)
      # Makes sure that the same instance of Version::NULL
      # will never equal itself; normally Comparable#==
      # will return true for this regardless of the return
      # value of #<=>
      false
    end
    def detected_from_url?
      false
    end
    def head?
      false
    end
    def null?
      true
    end
    def to_f
      Float::NAN
    end
    def to_i
      0
    end
    def to_s
      ""
    end
    alias_method :to_str, :to_s
    def inspect
      "#<Version::NULL>".freeze
    end
  end.new
end
 |