def version(version, **opts)
      requirements = version.split(",").map do |v|
        Gem::Requirement.new(v.strip)
      end

      providers = nil
      providers = Array(opts[:provider]).map(&:to_sym) if opts[:provider]

      @version_map.keys.sort.reverse.each do |v|
        next if !requirements.all? { |r| r.satisfied_by?(v) }
        version = Version.new(@version_map[v])
        next if (providers & version.providers).empty? if providers
        return version
      end

      nil
    end
def version(version, **opts)
      requirements = version.split(",").map do |v|
        Gem::Requirement.new(v.strip)
      end

      providers = nil
      providers = Array(opts[:provider]).map(&:to_sym) if opts[:provider]

      @version_map.keys.sort.reverse.each do |v|
        next if !requirements.all? { |r| r.satisfied_by?(v) }
        version = Version.new(@version_map[v])
        next if (providers & version.providers).empty? if providers
        return version
      end

      nil
    end
Loads the metadata associated with the box from the given
 IO.

 @param [IO] io An IO object to read the metadata from.
 Returns data about a single version that is included in this
 metadata.

 @param [String] version The version to return, this can also
   be a constraint.
 @return [Version] The matching version or nil if a matching
   version was not found.