lib/testlab/container/interface.rb in testlab-0.2.1 vs lib/testlab/container/interface.rb in testlab-0.3.0

- old
+ new

@@ -1,27 +1,20 @@ class TestLab class Container module Interface - # Returns the IP of the container - def ip - TestLab::Utility.ip(self.primary_interface.last[:ip]) - end - - # Returns the CIDR of the container - def cidr - TestLab::Utility.cidr(self.primary_interface.last[:ip]).to_i - end - - # Returns a BIND PTR record - def ptr - TestLab::Utility.ptr(self.primary_interface.last[:ip]) - end - + # Container primary interface + # + # Returns the primary interface for the container. If the container has + # multiple interfaces, this is based on which ever interface is marked + # with the primary flag. If the container only has one interface, then + # it is returned. + # + # @return [TestLab::Interface] The primary interface for the container. def primary_interface - if self.interfaces.any?{ |i,c| c[:primary] == true } - self.interfaces.find{ |i,c| c[:primary] == true } + if self.interfaces.any?{ |i| i.primary == true } + self.interfaces.find{ |i| i.primary == true } else self.interfaces.first end end