Sha256: 1711de3864d7be4ad5820366c2bdd37f2bfe72f6666264f9ba0aa6912fcd132e

Contents?: true

Size: 872 Bytes

Versions: 6

Compression:

Stored size: 872 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_envs/http/request'

module Avm
  module EacRubyBase1
    module Rubygems
      class Remote
        enable_simple_cache
        common_constructor :name

        # @return [Gem::Version, nil]
        def maximum_number
          numbers.max.if_present { |v| ::Gem::Version.new(v) }
        end

        # @return [Array<Gem::Version>]
        def numbers
          versions.map { |v| ::Gem::Version.new(v.fetch('number')) }
        end

        protected

        # @return [Array<Hash>]
        def versions_uncached
          ::EacEnvs::Http::Request.new
            .url("https://rubygems.org/api/v1/versions/#{name}.json")
            .response.body_data_or_raise
        rescue EacEnvs::Http::Response => e
          e.status == 404 ? [] : raise(e)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
avm-eac_ruby_base1-0.35.1 lib/avm/eac_ruby_base1/rubygems/remote.rb
eac_tools-0.96.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/remote.rb
avm-eac_ruby_base1-0.35.0 lib/avm/eac_ruby_base1/rubygems/remote.rb
eac_tools-0.95.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/remote.rb
avm-eac_ruby_base1-0.34.1 lib/avm/eac_ruby_base1/rubygems/remote.rb
eac_tools-0.91.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/remote.rb