extract_latest_version (Multiruby)

    # File lib/multiruby.rb, line 158
      def self.extract_latest_version url, matching=nil
        file = URI.parse(url).read
        versions = file.scan(/href="(ruby.*tar.gz)"/).flatten.reject { |s|
          s =~ /preview|-rc\d/
        }.sort_by { |s|
          s.split(/\D+/).map { |i| i.to_i }
        }.flatten
        versions = versions.grep(/#{Regexp.escape(matching)}/) if matching
        versions.last
      end