Created
December 11, 2019 10:01
-
-
Save FeepingCreature/86292f570c79180c64269ba7a023f4ee 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 | |
class Gem::Requirement | |
PREV_OPS = OPS | |
__send__ :remove_const, 'OPS' | |
__send__ :remove_const, 'PATTERN_RAW' | |
__send__ :remove_const, 'PATTERN' | |
OPS = PREV_OPS.merge({ | |
"^" => lambda { |v, r| v >= r && v.release < r.bump_major } | |
}).freeze | |
__send__ :remove_const, 'PREV_OPS' | |
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