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.



382
383
384
# File 'lib/nexpose/site.rb', line 382

def initialize(hostname)
  @host = hostname
end

Instance Attribute Details

#hostObject

Named host (usually DNS or Netbios name).



380
381
382
# File 'lib/nexpose/site.rb', line 380

def host
  @host
end

Instance Method Details

#<=>(other) ⇒ Object



388
389
390
# File 'lib/nexpose/site.rb', line 388

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


392
393
394
# File 'lib/nexpose/site.rb', line 392

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

#hashObject



396
397
398
# File 'lib/nexpose/site.rb', line 396

def hash
  to_xml.hash
end

#to_xmlObject



406
407
408
# File 'lib/nexpose/site.rb', line 406

def to_xml
  to_xml_elem.to_s
end

#to_xml_elemObject



400
401
402
403
404
# File 'lib/nexpose/site.rb', line 400

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