Class: Derelict::Box

Inherits:
Object
  • Object
show all
Defined in:
lib/derelict/box.rb,
lib/derelict/box/manager.rb,
lib/derelict/box/not_found.rb

Overview

Represents an individual Vagrant box for a particular provider

Defined Under Namespace

Classes: Manager, NotFound

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, provider) ⇒ Box

Initializes a box with a particular name and provider

* name:     The name of the box represented by this object
* provider: The provider of the box represented by this object


13
14
15
16
# File 'lib/derelict/box.rb', line 13

def initialize(name, provider)
  @name = name
  @provider = provider
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/derelict/box.rb', line 7

def name
  @name
end

#providerObject (readonly)

Returns the value of attribute provider.



7
8
9
# File 'lib/derelict/box.rb', line 7

def provider
  @provider
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

Ensure equivalent Boxes are equal to this one



19
20
21
# File 'lib/derelict/box.rb', line 19

def ==(other)
  other.name == name and other.provider == provider
end

#hashObject

Make equivalent Boxes hash to the same value



25
26
27
# File 'lib/derelict/box.rb', line 25

def hash
  name.hash ^ provider.hash
end