Class: Nexpose::HostName

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/nexpose/site.rb

Overview

Object that represents a hostname to be added to a site.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname) ⇒ HostName

Returns a new instance of HostName.



639
640
641
# File 'lib/nexpose/site.rb', line 639

def initialize(hostname)
  @host = hostname
end

Instance Attribute Details

#hostObject

Named host (usually DNS or Netbios name).



637
638
639
# File 'lib/nexpose/site.rb', line 637

def host
  @host
end

Instance Method Details

#<=>(other) ⇒ Object



645
646
647
# File 'lib/nexpose/site.rb', line 645

def <=>(other)
  to_xml <=> other.to_xml
end

#as_xmlObject Also known as: to_xml_elem



657
658
659
660
661
# File 'lib/nexpose/site.rb', line 657

def as_xml
  xml = REXML::Element.new('host')
  xml.text = @host
  xml
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


649
650
651
# File 'lib/nexpose/site.rb', line 649

def eql?(other)
  to_xml == other.to_xml
end

#hashObject



653
654
655
# File 'lib/nexpose/site.rb', line 653

def hash
  to_xml.hash
end

#to_sObject



668
669
670
# File 'lib/nexpose/site.rb', line 668

def to_s
  @host.to_s
end

#to_xmlObject



664
665
666
# File 'lib/nexpose/site.rb', line 664

def to_xml
  to_xml_elem.to_s
end