Sha256: a08d333f5aea7880d3ce47466545ff9939f50cebe9c68895e0da7c27d7539948
Contents?: true
Size: 946 Bytes
Versions: 3
Compression:
Stored size: 946 Bytes
Contents
# frozen_string_literal: true require 'open-uri' module Polariscope module Scanner module RubyVersions VERSIONS_INDEX_FILE_URL = 'https://cache.ruby-lang.org/pub/ruby/index.txt' MINIMUM_RUBY_VERSION = Gem::Version.new('1.0.0') OPEN_TIMEOUT = 5 READ_TIMEOUT = 5 module_function def available_versions # rubocop:disable Metrics/AbcSize URI .parse(VERSIONS_INDEX_FILE_URL) .open(open_timeout: OPEN_TIMEOUT, read_timeout: READ_TIMEOUT, &:readlines) .drop(1) # header row .map { |line| line.split("\t").first.sub('ruby-', 'ruby ') } # ruby-2.3.4 -> ruby 2.3.4 .filter_map { |ruby_version| Bundler::RubyVersion.from_string(ruby_version)&.gem_version } .select { |gem_version| gem_version >= MINIMUM_RUBY_VERSION && gem_version.segments.size == 3 } .to_set rescue Timeout::Error Set.new end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
polariscope-0.6.0 | lib/polariscope/scanner/ruby_versions.rb |
polariscope-0.5.0 | lib/polariscope/scanner/ruby_versions.rb |
polariscope-0.4.0 | lib/polariscope/scanner/ruby_versions.rb |