Created
December 11, 2019 09:56
-
-
Save FeepingCreature/8250003dda28415b625adfd31ef91965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# patch in ^ operator support | |
class Gem::Version | |
def bump_major | |
self.class.new segments[0].succ | |
end | |
end | |
PREV_OPS = Gem::Requirement::OPS | |
Gem::Requirement.__send__ :remove_const, 'OPS' | |
Gem::Requirement.__send__ :remove_const, 'PATTERN_RAW' | |
Gem::Requirement.__send__ :remove_const, 'PATTERN' | |
class Gem::Requirement | |
OPS = PREV_OPS.merge({ | |
"^" => lambda { |v, r| v >= r && v.release < r.bump_major } | |
}).freeze | |
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|" | |
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*".freeze | |
PATTERN = /\A#{PATTERN_RAW}\z/.freeze | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment