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.



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

def initialize(hostname)
  @host = hostname
end

Instance Attribute Details

#hostObject

Named host (usually DNS or Netbios name).



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

def host
  @host
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#hashObject



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

def hash
  to_xml.hash
end

#to_xmlObject



563
564
565
# File 'lib/nexpose/site.rb', line 563

def to_xml
  to_xml_elem.to_s
end

#to_xml_elemObject



557
558
559
560
561
# File 'lib/nexpose/site.rb', line 557

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