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.



519
520
521
# File 'lib/nexpose/site.rb', line 519

def initialize(hostname)
  @host = hostname
end

Instance Attribute Details

#hostObject

Named host (usually DNS or Netbios name).



517
518
519
# File 'lib/nexpose/site.rb', line 517

def host
  @host
end

Instance Method Details

#<=>(other) ⇒ Object



525
526
527
# File 'lib/nexpose/site.rb', line 525

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

#as_xmlObject Also known as: to_xml_elem



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

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#hashObject



533
534
535
# File 'lib/nexpose/site.rb', line 533

def hash
  to_xml.hash
end

#to_xmlObject



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

def to_xml
  to_xml_elem.to_s
end