Add small DSL for defining comparators
This commit is contained in:
parent
93baea7e47
commit
158b7047e5
@ -125,6 +125,13 @@ class Version
|
|||||||
m = /_([^_]+)/.match(stem)
|
m = /_([^_]+)/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# DSL for defining comparators
|
||||||
|
class << self
|
||||||
|
def compare &blk
|
||||||
|
send(:define_method, '<=>', &blk)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class VersionSchemeDetector
|
class VersionSchemeDetector
|
||||||
|
Loading…
x
Reference in New Issue
Block a user