[前][次][番号順一覧][スレッド一覧]

ruby-changes:72068

From: David <ko1@a...>
Date: Mon, 6 Jun 2022 18:36:43 +0900 (JST)
Subject: [ruby-changes:72068] ba38318827 (master): [rubygems/rubygems] Unify loading `Gem::Requirement`

https://git.ruby-lang.org/ruby.git/commit/?id=ba38318827

From ba383188279cd30abbb826f45af775fed3266221 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 3 Jun 2022 09:49:59 +0200
Subject: [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
---
 lib/rubygems.rb               | 1 +
 lib/rubygems/specification.rb | 1 -
 lib/rubygems/version.rb       | 2 --
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index e46dac0fd7..4eb67c7a16 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1303,6 +1303,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1303
   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__)
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index b0045ba511..5d94efe5bc 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -10,7 +10,6 @@ require_relative 'deprecate' https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L10
 require_relative 'basic_specification'
 require_relative 'stub_specification'
 require_relative 'platform'
-require_relative 'requirement'
 require_relative 'util/list'
 
 ##
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index c59501ad5d..c57bf7d6d5 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -153,8 +153,6 @@ require_relative "deprecate" https://github.com/ruby/ruby/blob/trunk/lib/rubygems/version.rb#L153
 # 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:
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]