aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-08-14 12:16:52 -0500
committerJack Nagel2012-08-18 11:12:10 -0500
commit610c65c908f8612e33fa5c6a6004d967ddad6baa (patch)
treec76b5aeab9ad3e96149310fac022f8860d7f97db /Library
parentc7cd378c6e0cf3feef1272e9b03ea5a8219d14d2 (diff)
downloadhomebrew-610c65c908f8612e33fa5c6a6004d967ddad6baa.tar.bz2
Add small DSL for defining comparators
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/version.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb
index 2591f74e3..7936efc80 100644
--- a/Library/Homebrew/version.rb
+++ b/Library/Homebrew/version.rb
@@ -125,6 +125,13 @@ class Version
m = /_([^_]+)/.match(stem)
return m.captures.first unless m.nil?
end
+
+ # DSL for defining comparators
+ class << self
+ def compare &blk
+ send(:define_method, '<=>', &blk)
+ end
+ end
end
class VersionSchemeDetector