Sha256: 3fe130c3d4d5b2e1ecbc56f27f1ae94269b0b5ff07cbb4ada9758ec7780dcd8c

Contents?: true

Size: 295 Bytes

Versions: 2

Compression:

Stored size: 295 Bytes

Contents

require 'net/http'

module Latest
  class MRIRetriever

    def retrieve(mri)
      page = Net::HTTP.get(URI(mri.source + mri.short_ver + '/'))
      page.scan(/(#{ Regexp.escape(mri.short_ver) }\.\d-[a-z0-9]+)\.zip/x).
        uniq.flatten.map { |v| RubyVersion.new(v) }.max
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
latest_ruby-0.0.2 lib/latest_ruby/retrievers/mri_retriever.rb
latest_ruby-0.0.1 lib/latest_ruby/retrievers/mri_retriever.rb