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.



529
530
531
# File 'lib/nexpose/site.rb', line 529

def initialize(hostname)
  @host = hostname
end

Instance Attribute Details

#hostObject

Named host (usually DNS or Netbios name).



527
528
529
# File 'lib/nexpose/site.rb', line 527

def host
  @host
end

Instance Method Details

#<=>(other) ⇒ Object



535
536
537
# File 'lib/nexpose/site.rb', line 535

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

#as_xmlObject Also known as: to_xml_elem



547
548
549
550
551
# File 'lib/nexpose/site.rb', line 547

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


539
540
541
# File 'lib/nexpose/site.rb', line 539

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

#hashObject



543
544
545
# File 'lib/nexpose/site.rb', line 543

def hash
  to_xml.hash
end

#to_xmlObject



554
555
556
# File 'lib/nexpose/site.rb', line 554

def to_xml
  to_xml_elem.to_s
end