aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorJack Nagel2012-08-14 12:16:52 -0500
committerJack Nagel2012-08-18 11:12:10 -0500
commit158b7047e516b6dda176cb1745e23c7109d049e9 (patch)
treeae6c5ef844c8a615978ba8588a80919d0041f849 /Library/Homebrew
parent93baea7e47627cdd309715143b7d125966a28df5 (diff)
downloadbrew-158b7047e516b6dda176cb1745e23c7109d049e9.tar.bz2
Add small DSL for defining comparators
Diffstat (limited to 'Library/Homebrew')
-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