class Construqt::HostId
Attributes
interfaces[RW]
Public Class Methods
create(&block)
click to toggle source
# File lib/construqt/hostid.rb, line 5 def self.create(&block) a = HostId.new() a.interfaces=[] block.call(a) return a end
Public Instance Methods
first_ipv4()
click to toggle source
# File lib/construqt/hostid.rb, line 36 def first_ipv4 ret = first_ipv4! throw "first_ipv4 failed #{self.interfaces.first.host.name}" unless ret ret end
first_ipv4!()
click to toggle source
# File lib/construqt/hostid.rb, line 27 def first_ipv4! self.interfaces.each do |i| next unless i.address return i.address if i.address.first_ipv4 end nil end
first_ipv6()
click to toggle source
# File lib/construqt/hostid.rb, line 21 def first_ipv6 ret = first_ipv6! throw "first_ipv6 failed #{self.interfaces.first.host.name}" unless ret ret end
first_ipv6!()
click to toggle source
# File lib/construqt/hostid.rb, line 12 def first_ipv6! self.interfaces.each do |i| next unless i.address return i.address if i.address.first_ipv6 end nil end