Sha256: 73355deba0f1bf1d4bbe820fdbbc2b72bff2483d6ee6858a283684f9b8a8b338

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

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

      def primary_interface
        if self.interfaces.any?{ |i,c| c[:primary] == true }
          self.interfaces.find{ |i,c| c[:primary] == true }
        else
          self.interfaces.first
        end
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
testlab-0.2.1 lib/testlab/container/interface.rb
testlab-0.2.0 lib/testlab/container/interface.rb