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.



609
610
611
# File 'lib/nexpose/site.rb', line 609

def initialize(hostname)
  @host = hostname
end

Instance Attribute Details

#hostObject

Named host (usually DNS or Netbios name).



607
608
609
# File 'lib/nexpose/site.rb', line 607

def host
  @host
end

Instance Method Details

#<=>(other) ⇒ Object



615
616
617
# File 'lib/nexpose/site.rb', line 615

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

#as_xmlObject Also known as: to_xml_elem



627
628
629
630
631
# File 'lib/nexpose/site.rb', line 627

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


619
620
621
# File 'lib/nexpose/site.rb', line 619

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

#hashObject



623
624
625
# File 'lib/nexpose/site.rb', line 623

def hash
  to_xml.hash
end

#to_sObject



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

def to_s
  @host.to_s
end

#to_xmlObject



634
635
636
# File 'lib/nexpose/site.rb', line 634

def to_xml
  to_xml_elem.to_s
end