diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
commit | 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch) | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/version.rb | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) | |
download | ruby-5335ce0e060c7a2a0b01c57f8f8a64254f2658e1.tar.gz |
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop
https://github.com/rubygems/rubygems/pull/2478
* Enable Style/MultilineIfThen in Rubocop
https://github.com/rubygems/rubygems/pull/2479
* Fix required_ruby_version with prereleases and improve error message
https://github.com/rubygems/rubygems/pull/2344
* Fix bundler rubygems binstub not properly looking for bundler
https://github.com/rubygems/rubygems/pull/2426
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/version.rb')
-rw-r--r-- | lib/rubygems/version.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb index d700aebd5d..fb7609c7c6 100644 --- a/lib/rubygems/version.rb +++ b/lib/rubygems/version.rb @@ -155,7 +155,7 @@ class Gem::Version include Comparable VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'.freeze # :nodoc: - ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc: + ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/.freeze # :nodoc: ## # A string representation of this Version. @@ -169,7 +169,7 @@ class Gem::Version ## # True if the +version+ string matches RubyGems' requirements. - def self.correct? version + def self.correct?(version) unless Gem::Deprecate.skip warn "nil versions are discouraged and will be deprecated in Rubygems 4" if version.nil? end @@ -185,10 +185,10 @@ class Gem::Version # ver2 = Version.create(ver1) # -> (ver1) # ver3 = Version.create(nil) # -> nil - def self.create input - if self === input then # check yourself before you wreck yourself + def self.create(input) + if self === input # check yourself before you wreck yourself input - elsif input.nil? then + elsif input.nil? nil else new input @@ -197,7 +197,7 @@ class Gem::Version @@all = {} - def self.new version # :nodoc: + def self.new(version) # :nodoc: return super unless Gem::Version == self @@all[version] ||= super @@ -207,7 +207,7 @@ class Gem::Version # Constructs a Version from the +version+ string. A version string is a # series of digits or ASCII letters separated by dots. - def initialize version + def initialize(version) unless self.class.correct?(version) raise ArgumentError, "Malformed version number string #{version}" end @@ -240,7 +240,7 @@ class Gem::Version # A Version is only eql? to another version if it's specified to the # same precision. Version "1.0" is not the same as version "1". - def eql? other + def eql?(other) self.class === other and @version == other._version end @@ -248,7 +248,7 @@ class Gem::Version canonical_segments.hash end - def init_with coder # :nodoc: + def init_with(coder) # :nodoc: yaml_initialize coder.tag, coder.map end @@ -268,7 +268,7 @@ class Gem::Version # Load custom marshal format. It's a string for backwards (RubyGems # 1.3.5 and earlier) compatibility. - def marshal_load array + def marshal_load(array) initialize array[0] end @@ -282,7 +282,7 @@ class Gem::Version ["@version"] end - def encode_with coder # :nodoc: + def encode_with(coder) # :nodoc: coder.add 'version', @version end @@ -296,7 +296,7 @@ class Gem::Version @prerelease end - def pretty_print q # :nodoc: + def pretty_print(q) # :nodoc: q.text "Gem::Version.new(#{version.inspect})" end @@ -339,7 +339,7 @@ class Gem::Version # one. Attempts to compare to something that's not a # <tt>Gem::Version</tt> return +nil+. - def <=> other + def <=>(other) return unless Gem::Version === other return 0 if @version == other._version || canonical_segments == other.canonical_segments |