Class: NetVbox::VmInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/netvbox/vm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ssh_connection_info, vm_name, snapshot_name) ⇒ VmInfo

Returns a new instance of VmInfo.



24
25
26
27
28
# File 'lib/netvbox/vm.rb', line 24

def initialize(ssh_connection_info, vm_name, snapshot_name)
  @ssh_connection_info = ssh_connection_info
  @vm_name = vm_name
  @snapshot_name = snapshot_name
end

Instance Attribute Details

#snapshot_nameObject (readonly)

Returns the value of attribute snapshot_name.



22
23
24
# File 'lib/netvbox/vm.rb', line 22

def snapshot_name
  @snapshot_name
end

#ssh_connection_infoObject (readonly)

Returns the value of attribute ssh_connection_info.



22
23
24
# File 'lib/netvbox/vm.rb', line 22

def ssh_connection_info
  @ssh_connection_info
end

#vm_nameObject (readonly)

Returns the value of attribute vm_name.



22
23
24
# File 'lib/netvbox/vm.rb', line 22

def vm_name
  @vm_name
end

Instance Method Details

#==(other) ⇒ Object



40
41
42
43
44
# File 'lib/netvbox/vm.rb', line 40

def ==(other)
  self.ssh_connection_info == other.ssh_connection_info &&
  self.vm_name == other.vm_name &&
  self.snapshot_name == other.snapshot_name
end

#clashes_with?(other) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/netvbox/vm.rb', line 30

def clashes_with?(other)
  clashes_with_params?(other.ssh_connection_info.hostname, other.ssh_connection_info.username, other.vm_name)
end

#clashes_with_params?(hostname, username, vm_name) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/netvbox/vm.rb', line 34

def clashes_with_params?(hostname, username, vm_name)
  self.ssh_connection_info.hostname == hostname &&
  self.ssh_connection_info.username == username &&
  self.vm_name == vm_name
end

#to_sObject



46
47
48
# File 'lib/netvbox/vm.rb', line 46

def to_s
  "host: #{self.ssh_connection_info.hostname}, vm: #{vm_name}, snapshot: #{snapshot_name}"
end