Class: Vagrant::LXC::MachineState

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

Constant Summary collapse

CREATED_STATES =
%w( running stopped ).map!(&:to_sym)

Instance Method Summary collapse

Constructor Details

#initialize(state_id) ⇒ MachineState

Returns a new instance of MachineState.



6
7
8
9
10
# File 'lib/vagrant-lxc/machine_state.rb', line 6

def initialize(state_id)
  short = state_id.to_s.gsub("_", " ")
  long  = I18n.t("vagrant.commands.status.#{state_id}")
  super(state_id, short, long)
end

Instance Method Details

#created?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/vagrant-lxc/machine_state.rb', line 12

def created?
  CREATED_STATES.include?(self.id)
end

#off?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/vagrant-lxc/machine_state.rb', line 16

def off?
  self.id == :stopped
end

#running?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/vagrant-lxc/machine_state.rb', line 20

def running?
  self.id == :running
end