diff options
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 |