summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-16 12:55:30 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-17 18:50:55 +0900
commit83f9aa8f02c9fdcf8d22f0859c4f4fb3ad30bb42 (patch)
tree0960c81245f3f30debb003255800f33901e168f3
parentf4d1f660d0c60072813fa46b0e704561ff8e20fe (diff)
downloadruby-83f9aa8f02c9fdcf8d22f0859c4f4fb3ad30bb42.tar.gz
[rubygems/rubygems] util/rubocop -A --only Style/Alias
https://github.com/rubygems/rubygems/commit/fba6e94de9
-rw-r--r--lib/rubygems/commands/query_command.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb2
-rw-r--r--lib/rubygems/dependency.rb2
-rw-r--r--lib/rubygems/errors.rb2
-rw-r--r--lib/rubygems/exceptions.rb2
-rw-r--r--lib/rubygems/name_tuple.rb2
-rw-r--r--lib/rubygems/package/tar_reader.rb2
-rw-r--r--lib/rubygems/package/tar_reader/entry.rb2
-rw-r--r--lib/rubygems/platform.rb2
-rw-r--r--lib/rubygems/remote_fetcher.rb2
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb2
-rw-r--r--lib/rubygems/request_set/lockfile/tokenizer.rb2
-rw-r--r--lib/rubygems/requirement.rb4
-rw-r--r--lib/rubygems/security/policy.rb2
-rw-r--r--lib/rubygems/specification.rb8
-rw-r--r--lib/rubygems/version.rb2
-rw-r--r--test/rubygems/test_gem_ext_builder.rb4
-rw-r--r--test/rubygems/test_gem_specification.rb4
-rw-r--r--test/rubygems/test_require.rb4
19 files changed, 26 insertions, 26 deletions
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index c6315acf8c..9d57d0c87e 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -9,7 +9,7 @@ class Gem::Commands::QueryCommand < Gem::Command
include Gem::QueryUtils
- alias warning_without_suggested_alternatives deprecation_warning
+ alias_method :warning_without_suggested_alternatives, :deprecation_warning
def deprecation_warning
warning_without_suggested_alternatives
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 94802571a6..6be8dad591 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -13,7 +13,7 @@ module Kernel
# Make sure we have a reference to Ruby's original Kernel#require
unless defined?(gem_original_require)
# :stopdoc:
- alias gem_original_require require
+ alias_method :gem_original_require, :require
private :gem_original_require
# :startdoc:
end
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index cd03e7e299..fde05e9332 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -204,7 +204,7 @@ class Gem::Dependency
requirement.satisfied_by? version
end
- alias === =~
+ alias_method :===, :=~
##
# :call-seq:
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb
index ac82a551a5..6f999e2715 100644
--- a/lib/rubygems/errors.rb
+++ b/lib/rubygems/errors.rb
@@ -174,6 +174,6 @@ module Gem
##
# The "exception" alias allows you to call raise on a SourceFetchProblem.
- alias exception error
+ alias_method :exception, :error
end
end
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb
index 625b4d2330..259bab0da4 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -222,7 +222,7 @@ class Gem::SystemExitException < SystemExit
##
# The exit code for the process
- alias exit_code status
+ alias_method :exit_code, :status
##
# Creates a new SystemExitException with the given +exit_code+
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index 767dc1fb45..3a75802b24 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -86,7 +86,7 @@ class Gem::NameTuple
"#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>"
end
- alias to_s inspect # :nodoc:
+ alias_method :to_s, :inspect # :nodoc:
def <=>(other)
[@name, @version, Gem::Platform.sort_priority(@platform)] <=>
diff --git a/lib/rubygems/package/tar_reader.rb b/lib/rubygems/package/tar_reader.rb
index 9f1d49035b..98c6fe7c00 100644
--- a/lib/rubygems/package/tar_reader.rb
+++ b/lib/rubygems/package/tar_reader.rb
@@ -62,7 +62,7 @@ class Gem::Package::TarReader
end
end
- alias each_entry each
+ alias_method :each_entry, :each
##
# NOTE: Do not call #rewind during #each
diff --git a/lib/rubygems/package/tar_reader/entry.rb b/lib/rubygems/package/tar_reader/entry.rb
index 9e7b327431..9cd43b9664 100644
--- a/lib/rubygems/package/tar_reader/entry.rb
+++ b/lib/rubygems/package/tar_reader/entry.rb
@@ -151,7 +151,7 @@ class Gem::Package::TarReader::Entry
@header.size
end
- alias length size
+ alias_method :length, :size
##
# Reads +len+ bytes from the tar file entry, or the rest of the entry if
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 4331831774..22009c56b5 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -141,7 +141,7 @@ class Gem::Platform
self.class === other && to_a == other.to_a
end
- alias :eql? :==
+ alias_method :eql?, :==
def hash # :nodoc:
to_a.hash
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 0ac6eaa130..658752798e 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -233,7 +233,7 @@ class Gem::RemoteFetcher
end
end
- alias :fetch_https :fetch_http
+ alias_method :fetch_https, :fetch_http
##
# Downloads +uri+ and returns it as a String.
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index dd2b526016..11b35dd8cd 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -767,7 +767,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
# Block form for restricting gems to a particular set of platforms. See
# #platform.
- alias :platforms :platform
+ alias_method :platforms, :platform
##
# :category: Gem Dependencies DSL
diff --git a/lib/rubygems/request_set/lockfile/tokenizer.rb b/lib/rubygems/request_set/lockfile/tokenizer.rb
index f5d9507668..59163e8cfb 100644
--- a/lib/rubygems/request_set/lockfile/tokenizer.rb
+++ b/lib/rubygems/request_set/lockfile/tokenizer.rb
@@ -48,7 +48,7 @@ class Gem::RequestSet::Lockfile::Tokenizer
def next_token
@tokens.shift
end
- alias :shift :next_token
+ alias_method :shift, :next_token
def peek
@tokens.first || EOF
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 030cb57842..72b89087ee 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -244,8 +244,8 @@ class Gem::Requirement
requirements.all? {|op, rv| OPS[op].call version, rv }
end
- alias :=== :satisfied_by?
- alias :=~ :satisfied_by?
+ alias_method :===, :satisfied_by?
+ alias_method :=~, :satisfied_by?
##
# True if the requirement will not always match the latest version.
diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb
index 913436fff7..d4449d670d 100644
--- a/lib/rubygems/security/policy.rb
+++ b/lib/rubygems/security/policy.rb
@@ -287,5 +287,5 @@ class Gem::Security::Policy
true
end
- alias to_s name # :nodoc:
+ alias_method :to_s, :name # :nodoc:
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index c11f67dc98..ea2721e41e 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -735,7 +735,7 @@ class Gem::Specification < Gem::BasicSpecification
attr_accessor :activated
- alias :activated? :activated
+ alias_method :activated?, :activated
##
# Autorequire was used by old RubyGems to automatically require a file.
@@ -1546,7 +1546,7 @@ class Gem::Specification < Gem::BasicSpecification
private :add_dependency_with_type
- alias add_dependency add_runtime_dependency
+ alias_method :add_dependency, :add_runtime_dependency
##
# Adds this spec's require paths to LOAD_PATH, in the proper location.
@@ -1991,7 +1991,7 @@ class Gem::Specification < Gem::BasicSpecification
end
rubygems_deprecate :has_rdoc=
- alias :has_rdoc? :has_rdoc # :nodoc:
+ alias_method :has_rdoc?, :has_rdoc # :nodoc:
rubygems_deprecate :has_rdoc?
##
@@ -2002,7 +2002,7 @@ class Gem::Specification < Gem::BasicSpecification
end
# :stopdoc:
- alias has_test_suite? has_unit_tests?
+ alias_method :has_test_suite?, :has_unit_tests?
# :startdoc:
def hash # :nodoc:
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index c319e1f820..52bfed6937 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -165,7 +165,7 @@ class Gem::Version
@version.dup
end
- alias to_s version
+ alias_method :to_s, :version
##
# True if the +version+ string matches RubyGems' requirements.
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index dcf02156df..1241a34cfc 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -153,7 +153,7 @@ install:
def test_build_extensions_install_ext_only
class << Gem
- alias orig_install_extension_in_lib install_extension_in_lib
+ alias_method :orig_install_extension_in_lib, :install_extension_in_lib
remove_method :install_extension_in_lib
@@ -199,7 +199,7 @@ install:
class << Gem
remove_method :install_extension_in_lib
- alias install_extension_in_lib orig_install_extension_in_lib
+ alias_method :install_extension_in_lib, :orig_install_extension_in_lib
end
end
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 319597b45f..5d6bf9361f 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1704,7 +1704,7 @@ dependencies: []
RbConfig::CONFIG["ENABLE_SHARED"], "no"
class << Gem
- alias orig_default_ext_dir_for default_ext_dir_for
+ alias_method :orig_default_ext_dir_for, :default_ext_dir_for
remove_method :default_ext_dir_for
@@ -1726,7 +1726,7 @@ dependencies: []
class << Gem
remove_method :default_ext_dir_for
- alias default_ext_dir_for orig_default_ext_dir_for
+ alias_method :default_ext_dir_for, :orig_default_ext_dir_for
end
end
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index af07364bb5..0afe3a61d6 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -541,7 +541,7 @@ class TestGemRequire < Gem::TestCase
def test_try_activate_error_unlocks_require_monitor
silence_warnings do
class << ::Gem
- alias old_try_activate try_activate
+ alias_method :old_try_activate, :try_activate
def try_activate(*); raise "raised from try_activate"; end
end
end
@@ -553,7 +553,7 @@ class TestGemRequire < Gem::TestCase
ensure
silence_warnings do
class << ::Gem
- alias try_activate old_try_activate
+ alias_method :try_activate, :old_try_activate
end
end
Kernel::RUBYGEMS_ACTIVATION_MONITOR.exit