Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Commands::PushCommand#resolve_gem_name
resolve_gem_name(names)
lib/rubygems/commands/push_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/commands/push_command.rb, line 112
def resolve_gem_name(names)
platform = options[:platform] && Gem::Platform.new(options[:platform])
ruby_abi = options[:ruby_abi]
candidates = names.filter_map do |name|
[name, Gem::Package.new(name).spec]
rescue Gem::Package::FormatError => e
alert_warning "Skipping #{name}: #{e.message}"
nil
end
matches = candidates.select do |_, spec|
(!platform || spec.platform == platform) &&
(!ruby_abi || (Gem::ContentAddress.eligible?(spec) && spec.ruby_abi == ruby_abi))
end
raise Gem::CommandLineError, "No gem matched #{gem_name_selector_description}" if matches.empty?
raise Gem::CommandLineError, multiple_matches_message(matches) if matches.length > 1
matches.first.first
end
No documentation available