1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Unify loading Gem::Requirement

It was being explicitly required from `Gem::Specification` but also a
strange autoload was set for it at `Gem::Version`. The autoload was non
standard because it should've been done in the `Gem` module, not in
`Gem::Specification`, since that's where the constant is expected to get
defined. Doing this might get deprecated in the future, and it was not
being effective anyways due to the explicit require.

Unify everything with an `autoload` at the right place.

https://github.com/rubygems/rubygems/commit/174ea3e24c
This commit is contained in:
David Rodríguez 2022-06-03 09:49:59 +02:00 committed by git
parent f4173ff2fa
commit ba38318827
3 changed files with 1 additions and 3 deletions

View file

@ -1303,6 +1303,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__)
autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__)
autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__)
autoload :Requirement, File.expand_path('rubygems/requirement', __dir__)
autoload :Resolver, File.expand_path('rubygems/resolver', __dir__)
autoload :Source, File.expand_path('rubygems/source', __dir__)
autoload :SourceList, File.expand_path('rubygems/source_list', __dir__)

View file

@ -10,7 +10,6 @@ require_relative 'deprecate'
require_relative 'basic_specification'
require_relative 'stub_specification'
require_relative 'platform'
require_relative 'requirement'
require_relative 'util/list'
##

View file

@ -153,8 +153,6 @@ require_relative "deprecate"
# a zero to give a sensible result.
class Gem::Version
autoload :Requirement, File.expand_path('requirement', __dir__)
include Comparable
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?'.freeze # :nodoc: