Class: LXC::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/lxc/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state, pid) ⇒ Status

Returns a new instance of Status.



5
6
7
8
# File 'lib/lxc/status.rb', line 5

def initialize(state, pid)
  @state = state.to_s.downcase
  @pid = Integer(pid)
end

Instance Attribute Details

#pidObject (readonly)

Returns the value of attribute pid.



3
4
5
# File 'lib/lxc/status.rb', line 3

def pid
  @pid
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/lxc/status.rb', line 3

def state
  @state
end

Instance Method Details

#==(instance) ⇒ Object



10
11
12
# File 'lib/lxc/status.rb', line 10

def == (instance)
  instance.pid == pid && instance.state == state
end

#to_hashObject



14
15
16
# File 'lib/lxc/status.rb', line 14

def to_hash
  {'state' => state, 'pid' => pid}
end

#to_sObject



18
19
20
# File 'lib/lxc/status.rb', line 18

def to_s
  "state=#{state} pid=#{pid}"
end