summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/available_set.rb2
-rw-r--r--lib/rubygems/command.rb4
-rw-r--r--lib/rubygems/command_manager.rb2
-rw-r--r--lib/rubygems/commands/cleanup_command.rb8
-rw-r--r--lib/rubygems/commands/dependency_command.rb4
-rw-r--r--lib/rubygems/commands/help_command.rb2
-rw-r--r--lib/rubygems/commands/pristine_command.rb4
-rw-r--r--lib/rubygems/commands/specification_command.rb2
-rw-r--r--lib/rubygems/commands/uninstall_command.rb2
-rw-r--r--lib/rubygems/commands/unpack_command.rb2
-rw-r--r--lib/rubygems/commands/update_command.rb2
-rw-r--r--lib/rubygems/config_file.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb4
-rw-r--r--lib/rubygems/dependency.rb2
-rw-r--r--lib/rubygems/dependency_list.rb2
-rw-r--r--lib/rubygems/doctor.rb2
-rw-r--r--lib/rubygems/install_update_options.rb2
-rw-r--r--lib/rubygems/installer.rb2
-rw-r--r--lib/rubygems/name_tuple.rb2
-rw-r--r--lib/rubygems/package.rb4
-rw-r--r--lib/rubygems/query_utils.rb2
-rw-r--r--lib/rubygems/remote_fetcher.rb2
-rw-r--r--lib/rubygems/request/connection_pools.rb2
-rw-r--r--lib/rubygems/request_set.rb4
-rw-r--r--lib/rubygems/request_set/lockfile.rb8
-rw-r--r--lib/rubygems/resolver.rb2
-rw-r--r--lib/rubygems/resolver/composed_set.rb2
-rw-r--r--lib/rubygems/resolver/conflict.rb2
-rw-r--r--lib/rubygems/resolver/installer_set.rb2
-rw-r--r--lib/rubygems/resolver/lock_set.rb2
-rw-r--r--lib/rubygems/source/local.rb2
-rw-r--r--lib/rubygems/spec_fetcher.rb2
-rw-r--r--lib/rubygems/specification.rb16
-rw-r--r--lib/rubygems/uninstaller.rb8
34 files changed, 51 insertions, 61 deletions
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
index 553640c643..1606bc7016 100644
--- a/lib/rubygems/available_set.rb
+++ b/lib/rubygems/available_set.rb
@@ -69,7 +69,7 @@ class Gem::AvailableSet
end
def all_specs
- @set.map {|t| t.spec }
+ @set.map(&:spec)
end
def match_platform!
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index ce057af440..896bc95745 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -19,9 +19,7 @@ require_relative "user_interaction"
class Gem::Command
include Gem::UserInteraction
- Gem::OptionParser.accept Symbol do |value|
- value.to_sym
- end
+ Gem::OptionParser.accept Symbol, &:to_sym
##
# The name of the command.
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index f8b9796b37..5ceaf1c63c 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -140,7 +140,7 @@ class Gem::CommandManager
# Return a sorted list of all command names as strings.
def command_names
- @commands.keys.collect {|key| key.to_s }.sort
+ @commands.keys.collect(&:to_s).sort
end
##
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index 0f53227d9a..91e8e4730a 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -74,7 +74,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
until done do
clean_gems
- this_set = @gems_to_cleanup.map {|spec| spec.full_name }.sort
+ this_set = @gems_to_cleanup.map(&:full_name).sort
done = this_set.empty? || last_set == this_set
@@ -87,7 +87,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
say "Clean up complete"
verbose do
- skipped = @default_gems.map {|spec| spec.full_name }
+ skipped = @default_gems.map(&:full_name)
"Skipped default gems: #{skipped.join ", "}"
end
@@ -130,9 +130,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
@primary_gems[spec.name].version != spec.version
end
- default_gems, gems_to_cleanup = gems_to_cleanup.partition do |spec|
- spec.default_gem?
- end
+ default_gems, gems_to_cleanup = gems_to_cleanup.partition(&:default_gem?)
uninstall_from = options[:user_install] ? Gem.user_dir : @original_home
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index a5870e9106..b258cd3349 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -90,7 +90,7 @@ use with other commands.
def display_pipe(specs) # :nodoc:
specs.each do |spec|
unless spec.dependencies.empty?
- spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
+ spec.dependencies.sort_by(&:name).each do |dep|
say "#{dep.name} --version '#{dep.requirement}'"
end
end
@@ -152,7 +152,7 @@ use with other commands.
response = String.new
response << " " * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty?
- spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
+ spec.dependencies.sort_by(&:name).each do |dep|
response << " " * level + " #{dep}\n"
end
end
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index a64c3e128d..68f0b44dad 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -323,7 +323,7 @@ platform.
margin_width = 4
- desc_width = @command_manager.command_names.map {|n| n.size }.max + 4
+ desc_width = @command_manager.command_names.map(&:size).max + 4
summary_width = 80 - margin_width - desc_width
wrap_indent = " " * (margin_width + desc_width)
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 6f0f7be7c9..e64f056cb0 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -113,9 +113,7 @@ extensions will be restored.
spec.extensions && !spec.extensions.empty?
end
elsif options[:only_missing_extensions]
- Gem::Specification.select do |spec|
- spec.missing_extensions?
- end
+ Gem::Specification.select(&:missing_extensions?)
else
get_all_gem_names.sort.map do |gem_name|
Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index fc2fb49ceb..5bc68efa3a 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -137,7 +137,7 @@ Specific fields in the specification can be extracted in YAML format:
end
unless options[:all]
- specs = [specs.max_by {|s| s.version }]
+ specs = [specs.max_by(&:version)]
end
specs.each do |s|
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index aa05cda2c8..74c11dd64b 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -137,7 +137,7 @@ that is a dependency of an existing gem. You can use the
end
def uninstall_all
- specs = Gem::Specification.reject {|spec| spec.default_gem? }
+ specs = Gem::Specification.reject(&:default_gem?)
specs.each do |spec|
options[:version] = spec.version
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index 314571dee6..cf619fa744 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -154,7 +154,7 @@ command help for an example.
specs = dependency.matching_specs
- selected = specs.max_by {|s| s.version }
+ selected = specs.max_by(&:version)
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless
selected
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 837972a8e7..14a9cb76f8 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -119,7 +119,7 @@ command to remove old versions.
updated = update_gems gems_to_update
installed_names = highest_installed_gems.keys
- updated_names = updated.map {|spec| spec.name }
+ updated_names = updated.map(&:name)
not_updated_names = options[:args].uniq - updated_names
not_installed_names = not_updated_names - installed_names
up_to_date_names = not_updated_names - not_installed_names
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 00467443ac..21ce07c21e 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -476,7 +476,7 @@ if you believe they were disclosed to a third party.
yaml_hash[:ssl_client_cert] =
@hash[:ssl_client_cert] if @hash.key? :ssl_client_cert
- keys = yaml_hash.keys.map {|key| key.to_s }
+ keys = yaml_hash.keys.map(&:to_s)
keys << "debug"
re = Regexp.union(*keys)
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index d92b3429e4..5f768f3b23 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -112,9 +112,7 @@ module Kernel
if found_specs.empty?
found_specs = Gem::Specification.find_in_unresolved_tree path
- found_specs.each do |found_spec|
- found_spec.activate
- end
+ found_specs.each(&:activate)
# We found +path+ directly in an unresolved gem. Now we figure out, of
# the possible found specs, which one we should activate.
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index f8143de64a..5d6aa63d79 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -325,7 +325,7 @@ class Gem::Dependency
def to_spec
matches = self.to_specs.compact
- active = matches.find {|spec| spec.activated? }
+ active = matches.find(&:activated?)
return active if active
unless prerelease?
diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
index eaf6702177..e76dbe7c1c 100644
--- a/lib/rubygems/dependency_list.rb
+++ b/lib/rubygems/dependency_list.rb
@@ -104,7 +104,7 @@ class Gem::DependencyList
end
def inspect # :nodoc:
- "%s %p>" % [super[0..-2], map {|s| s.full_name }]
+ "%s %p>" % [super[0..-2], map(&:full_name)]
end
##
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
index 600b6f4f55..f1f1d34403 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -52,7 +52,7 @@ class Gem::Doctor
# Specs installed in this gem repository
def installed_specs # :nodoc:
- @installed_specs ||= Gem::Specification.map {|s| s.full_name }
+ @installed_specs ||= Gem::Specification.map(&:full_name)
end
##
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index b95a56f03f..24d2eec918 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -154,7 +154,7 @@ module Gem::InstallUpdateOptions
"Omit the named groups (comma separated)",
"when installing from a gem dependencies",
"file") do |v,_o|
- options[:without_groups].concat v.map {|without| without.intern }
+ options[:without_groups].concat v.map(&:intern)
end
add_option(:"Install/Update", "--default",
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 9089771283..c8ac76db2b 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -588,7 +588,7 @@ class Gem::Installer
def shebang(bin_file_name)
path = File.join gem_dir, spec.bindir, bin_file_name
- first_line = File.open(path, "rb") {|file| file.gets } || ""
+ first_line = File.open(path, "rb", &:gets) || ""
if first_line.start_with?("#!")
# Preserve extra words on shebang line, like "-w". Thanks RPA.
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index 8e39fc3a4f..8754ac6c77 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -31,7 +31,7 @@ class Gem::NameTuple
# [name, version, platform] tuples.
def self.to_basic(list)
- list.map {|t| t.to_a }
+ list.map(&:to_a)
end
##
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 0e5905e8bf..b33ab1ab2f 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -571,10 +571,10 @@ EOM
)
@spec.signing_key = nil
- @spec.cert_chain = @signer.cert_chain.map {|cert| cert.to_s }
+ @spec.cert_chain = @signer.cert_chain.map(&:to_s)
else
@signer = Gem::Security::Signer.new nil, nil, passphrase
- @spec.cert_chain = @signer.cert_chain.map {|cert| cert.to_pem } if
+ @spec.cert_chain = @signer.cert_chain.map(&:to_pem) if
@signer.cert_chain
end
end
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb
index 859d231e61..9a6a736461 100644
--- a/lib/rubygems/query_utils.rb
+++ b/lib/rubygems/query_utils.rb
@@ -242,7 +242,7 @@ module Gem::QueryUtils
list =
if platforms.empty? || options[:details]
- name_tuples.map {|n| n.version }.uniq
+ name_tuples.map(&:version).uniq
else
platforms.sort.reverse.map do |version, pls|
out = version.to_s
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 708b93209f..a3cb36e951 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -324,7 +324,7 @@ class Gem::RemoteFetcher
end
def close_all
- @pools.each_value {|pool| pool.close_all }
+ @pools.each_value(&:close_all)
end
private
diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb
index 38f8db4ce0..b7ad92f5c6 100644
--- a/lib/rubygems/request/connection_pools.rb
+++ b/lib/rubygems/request/connection_pools.rb
@@ -28,7 +28,7 @@ class Gem::Request::ConnectionPools # :nodoc:
end
def close_all
- @pools.each_value {|pool| pool.close_all }
+ @pools.each_value(&:close_all)
end
private
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index f1af47618b..270bd9351e 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -375,7 +375,7 @@ class Gem::RequestSet
q.text "sets:"
q.breakable
- q.pp @sets.map {|set| set.class }
+ q.pp @sets.map(&:class)
end
end
@@ -429,7 +429,7 @@ class Gem::RequestSet
end
def specs
- @specs ||= @requests.map {|r| r.full_spec }
+ @specs ||= @requests.map(&:full_spec)
end
def specs_in(dir)
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index 7ec9500406..40f06915db 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -105,7 +105,7 @@ class Gem::RequestSet::Lockfile
out << " remote: #{group}"
out << " specs:"
- requests.sort_by {|request| request.name }.each do |request|
+ requests.sort_by(&:name).each do |request|
next if request.spec.name == "bundler"
platform = "-#{request.spec.platform}" unless
Gem::Platform::RUBY == request.spec.platform
@@ -137,10 +137,10 @@ class Gem::RequestSet::Lockfile
out << " revision: #{revision}"
out << " specs:"
- requests.sort_by {|request| request.name }.each do |request|
+ requests.sort_by(&:name).each do |request|
out << " #{request.name} (#{request.version})"
- dependencies = request.spec.dependencies.sort_by {|dep| dep.name }
+ dependencies = request.spec.dependencies.sort_by(&:name)
dependencies.each do |dep|
out << " #{dep.name}#{dep.requirement.for_lockfile}"
end
@@ -184,7 +184,7 @@ class Gem::RequestSet::Lockfile
platforms = requests.map {|request| request.spec.platform }.uniq
- platforms = platforms.sort_by {|platform| platform.to_s }
+ platforms = platforms.sort_by(&:to_s)
platforms.each do |platform|
out << " #{platform}"
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index 76d1e9d0cc..da67b79520 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -114,7 +114,7 @@ class Gem::Resolver
def explain(stage, *data) # :nodoc:
return unless DEBUG_RESOLVER
- d = data.map {|x| x.pretty_inspect }.join(", ")
+ d = data.map(&:pretty_inspect).join(", ")
$stderr.printf "%10s %s\n", stage.to_s.upcase, d
end
diff --git a/lib/rubygems/resolver/composed_set.rb b/lib/rubygems/resolver/composed_set.rb
index 226da1e1e0..1392a6c006 100644
--- a/lib/rubygems/resolver/composed_set.rb
+++ b/lib/rubygems/resolver/composed_set.rb
@@ -43,7 +43,7 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
end
def errors
- @errors + @sets.map {|set| set.errors }.flatten
+ @errors + @sets.map(&:errors).flatten
end
##
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb
index fa0d3f089e..aec0f2da0a 100644
--- a/lib/rubygems/resolver/conflict.rb
+++ b/lib/rubygems/resolver/conflict.rb
@@ -54,7 +54,7 @@ class Gem::Resolver::Conflict
activated = @activated.spec.full_name
dependency = @failed_dep.dependency
requirement = dependency.requirement
- alternates = dependency.matching_specs.map {|spec| spec.full_name }
+ alternates = dependency.matching_specs.map(&:full_name)
unless alternates.empty?
matching = <<-MATCHING.chomp
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
index 4e794c2ea5..ad77a86f1a 100644
--- a/lib/rubygems/resolver/installer_set.rb
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -184,7 +184,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
def inspect # :nodoc:
- always_install = @always_install.map {|s| s.full_name }
+ always_install = @always_install.map(&:full_name)
"#<%s domain: %s specs: %p always install: %p>" % [
self.class, @domain, @specs.keys, always_install
diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb
index b1a5433cb5..b8b8e03df3 100644
--- a/lib/rubygems/resolver/lock_set.rb
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -74,7 +74,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
q.text "specs:"
q.breakable
- q.pp @specs.map {|spec| spec.full_name }
+ q.pp @specs.map(&:full_name)
end
end
end
diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb
index e8553a4289..0007b39bee 100644
--- a/lib/rubygems/source/local.rb
+++ b/lib/rubygems/source/local.rb
@@ -92,7 +92,7 @@ class Gem::Source::Local < Gem::Source
end
end
- found.max_by {|s| s.version }
+ found.max_by(&:version)
end
def fetch_spec(name) # :nodoc:
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index ce58b24e7d..86eee5bcda 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -249,7 +249,7 @@ class Gem::SpecFetcher
def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
@caches[type][source.uri] ||=
- source.load_specs(type).sort_by {|tup| tup.name }
+ source.load_specs(type).sort_by(&:name)
rescue Gem::RemoteFetcher::FetchError
raise unless gracefully_ignore
[]
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 8d2a14ffee..d1079cc42c 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -174,7 +174,7 @@ class Gem::Specification < Gem::BasicSpecification
end
end
- @@attributes = @@default_value.keys.sort_by {|s| s.to_s }
+ @@attributes = @@default_value.keys.sort_by(&:to_s)
@@array_attributes = @@default_value.reject {|_k,v| v != [] }.keys
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
@@default_value[k].nil?
@@ -857,7 +857,7 @@ class Gem::Specification < Gem::BasicSpecification
installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
stubs = installed_stubs + default_stubs(pattern)
- stubs = stubs.uniq {|stub| stub.full_name }
+ stubs = stubs.uniq(&:full_name)
_resort!(stubs)
stubs
end
@@ -1084,7 +1084,7 @@ class Gem::Specification < Gem::BasicSpecification
end
def self.unresolved_specs
- unresolved_deps.values.map {|dep| dep.to_specs }.flatten
+ unresolved_deps.values.map(&:to_specs).flatten
end
private_class_method :unresolved_specs
@@ -1143,7 +1143,7 @@ class Gem::Specification < Gem::BasicSpecification
result[spec.name] = spec
end
- result.map(&:last).flatten.sort_by {|tup| tup.name }
+ result.map(&:last).flatten.sort_by(&:name)
end
##
@@ -1269,7 +1269,7 @@ class Gem::Specification < Gem::BasicSpecification
def self.reset
@@dirs = nil
- Gem.pre_reset_hooks.each {|hook| hook.call }
+ Gem.pre_reset_hooks.each(&:call)
clear_specs
clear_load_cache
unresolved = unresolved_deps
@@ -1288,7 +1288,7 @@ class Gem::Specification < Gem::BasicSpecification
warn "Please report a bug if this causes problems."
unresolved.clear
end
- Gem.post_reset_hooks.each {|hook| hook.call }
+ Gem.post_reset_hooks.each(&:call)
end
# DOC: This method needs documented or nodoc'd
@@ -1600,7 +1600,7 @@ class Gem::Specification < Gem::BasicSpecification
def build_args
if File.exist? build_info_file
build_info = File.readlines build_info_file
- build_info = build_info.map {|x| x.strip }
+ build_info = build_info.map(&:strip)
build_info.delete ""
build_info
else
@@ -1824,7 +1824,7 @@ class Gem::Specification < Gem::BasicSpecification
# Returns all specs that matches this spec's runtime dependencies.
def dependent_specs
- runtime_dependencies.map {|dep| dep.to_specs }.flatten
+ runtime_dependencies.map(&:to_specs).flatten
end
##
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index d5465b32fe..5c9a59f13e 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -98,9 +98,7 @@ class Gem::Uninstaller
raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
end
- default_specs, list = list.partition do |spec|
- spec.default_gem?
- end
+ default_specs, list = list.partition(&:default_gem?)
warn_cannot_uninstall_default_gems(default_specs - list)
@default_specs_matching_uninstall_params = default_specs
@@ -114,7 +112,7 @@ class Gem::Uninstaller
if list.empty?
return unless other_repo_specs.any?
- other_repos = other_repo_specs.map {|spec| spec.base_dir }.uniq
+ other_repos = other_repo_specs.map(&:base_dir).uniq
message = ["#{@gem} is not installed in GEM_HOME, try:"]
message.concat other_repos.map {|repo|
@@ -126,7 +124,7 @@ class Gem::Uninstaller
remove_all list
elsif list.size > 1
- gem_names = list.map {|gem| gem.full_name }
+ gem_names = list.map(&:full_name)
gem_names << "All versions"
say