class Vagrant::BoxMetadata::Version

Represents a single version within the metadata.

Attributes

version[RW]

The version that this Version object represents.

@return [String]

Public Class Methods

new(raw=nil, **_) click to toggle source
# File lib/vagrant/box_metadata.rb, line 102
def initialize(raw=nil, **_)
  return if !raw

  @version = raw["version"]
  @provider_map = (raw["providers"] || []).map do |p|
    [p["name"].to_sym, p]
  end
  @provider_map = Hash[@provider_map]
end

Public Instance Methods

provider(name) click to toggle source

Returns a [Provider] for the given name, or nil if it isn’t supported by this version.

# File lib/vagrant/box_metadata.rb, line 114
def provider(name)
  p = @provider_map[name.to_sym]
  return nil if !p
  Provider.new(p)
end
providers() click to toggle source

Returns the providers that are available for this version of the box.

@return [Array<Symbol>]

# File lib/vagrant/box_metadata.rb, line 124
def providers
  @provider_map.keys.map(&:to_sym)
end