aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/version
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/version')
-rw-r--r--Library/Homebrew/version/null.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/Library/Homebrew/version/null.rb b/Library/Homebrew/version/null.rb
new file mode 100644
index 000000000..77106bcce
--- /dev/null
+++ b/Library/Homebrew/version/null.rb
@@ -0,0 +1,38 @@
+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_s
+ ""
+ end
+ alias_method :to_str, :to_s
+ end.new
+end