Sha256: 3df98a0e8624551a7620e2f2ada4d4d47d335472a3fc4eb126c0bcf77e9703f0

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

module Nmap
  class XML
    #
    # Represents a hostname.
    #
    # @since 1.0.0
    #
    class Hostname < Struct.new(:type, :name)

      #
      # Determines if the hostname was specified by the user.
      #
      # @return [Boolean]
      #
      # @since 0.8.0
      #
      def user?
        self.type == 'user'
      end

      #
      # Determines if the hostname is a DNS `PTR`.
      #
      # @return [Boolean]
      #
      # @since 0.8.0
      #
      def ptr?
        self.type == 'PTR'
      end

      #
      # Converts the hostname to a String.
      #
      # @return [String]
      #   The name of the host.
      #
      def to_s
        self.name.to_s
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-nmap-1.0.3 lib/nmap/xml/hostname.rb