Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::Source#created_at
created_at(name, version, suffix = Gem::Platform::RUBY)
lib/rubygems/source.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/source.rb, line 248
def created_at(name, version, suffix = Gem::Platform::RUBY)
return unless %w[http https].include?(uri.scheme)
@created_at_info ||= {}
info = @created_at_info[name] ||= begin
compact_index_client.fetch_info(name)
rescue Gem::RemoteFetcher::FetchError, Gem::CompactIndexClient::Error
[]
end
suffix = (suffix || Gem::Platform::RUBY).to_s
version = version.to_s
row = info.find do |row_info|
row_info[Gem::CompactIndexClient::INFO_VERSION] == version &&
(row_info[Gem::CompactIndexClient::INFO_SUFFIX] || Gem::Platform::RUBY) == suffix
end
return unless row
value = row[Gem::CompactIndexClient::INFO_REQS].assoc("created_at")&.last&.first
Gem::Cooldown.parse_created_at(value)
end
The publish time of gem name at version for suffix, when this source provides it through the compact index created_at metadata. Returns nil when the source, the gem or the version has no known publish time.