Class: Vagrant::MachineState

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/machine_state.rb

Overview

This represents the state of a given machine. This is a very basic class that simply stores a short and long description of the state of a machine.

The state also stores a state "id" which can be used as a unique identifier for a state. This should be a symbol. This allows internal code to compare state such as ":not_created" instead of using string comparison.

The short description should be a single word description of the state of the machine such as "running" or "not created".

The long description can span multiple lines describing what the state actually means.

Constant Summary collapse

NOT_CREATED_ID =

This is a special ID that can be set for the state ID that tells Vagrant that the machine is not created. If this is the case, then Vagrant will set the ID to nil which will automatically clean out the machine data directory.

:not_created

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, short, long) ⇒ MachineState

Creates a new instance to represent the state of a machine.

Parameters:

  • id (Symbol)

    Unique identifier for this state.

  • short (String)

    Short (preferably one-word) description of the state.

  • long (String)

    Long description (can span multiple lines) of the state.



48
49
50
51
52
# File 'lib/vagrant/machine_state.rb', line 48

def initialize(id, short, long)
  @id                = id
  @short_description = short
  @long_description  = long
end

Instance Attribute Details

#idSymbol (readonly)

Unique ID for this state.

Returns:

  • (Symbol)


29
30
31
# File 'lib/vagrant/machine_state.rb', line 29

def id
  @id
end

#long_descriptionString (readonly)

Long description for this state.

Returns:

  • (String)


39
40
41
# File 'lib/vagrant/machine_state.rb', line 39

def long_description
  @long_description
end

#short_descriptionString (readonly)

Short description for this state.

Returns:

  • (String)


34
35
36
# File 'lib/vagrant/machine_state.rb', line 34

def short_description
  @short_description
end