Class: VagrantPlugins::Multiplug::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_plugins/multiplug/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version = nil) ⇒ Dependency

Returns a new instance of Dependency.



18
19
20
21
# File 'lib/vagrant_plugins/multiplug/config.rb', line 18

def initialize(name, version = nil)
  @name = name
  @version = version
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/vagrant_plugins/multiplug/config.rb', line 16

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version.



16
17
18
# File 'lib/vagrant_plugins/multiplug/config.rb', line 16

def version
  @version
end

Instance Method Details

#installed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/vagrant_plugins/multiplug/config.rb', line 23

def installed?
  ::Vagrant.has_plugin?(@name, @version)
end

#optionsString

Returns Command-line options for ‘vagrant plugin install NAME`.

Returns:

  • (String)

    Command-line options for ‘vagrant plugin install NAME`



28
29
30
31
32
# File 'lib/vagrant_plugins/multiplug/config.rb', line 28

def options
  if @version
    "--plugin-version #{@version}"
  end
end