Class: Nexpose::IPRange

Inherits:
Object
  • Object
show all
Includes:
Sanitize
Defined in:
lib/nexpose.rb

Overview

Description

Object that represents a single IP address or an inclusive range of IP addresses. If to is nil then the from field will be used to specify a single IP Address only.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sanitize

#replace_entities

Constructor Details

#initialize(from, to = nil) ⇒ IPRange

Returns a new instance of IPRange.



989
990
991
992
# File 'lib/nexpose.rb', line 989

def initialize(from, to = nil)
	@from = from
	@to = to
end

Instance Attribute Details

#fromObject (readonly)

Start of Range *Required



985
986
987
# File 'lib/nexpose.rb', line 985

def from
  @from
end

#toObject (readonly)

End of Range *Optional (If Null then IPRange is a single IP Address)



987
988
989
# File 'lib/nexpose.rb', line 987

def to
  @to
end

Instance Method Details

#to_xmlObject



995
996
997
998
999
1000
1001
# File 'lib/nexpose.rb', line 995

def to_xml
	if (to and not to.empty?)
		return %Q{<range from="#{from}" to="#{to}"/>}
	else
		return %Q{<range from="#{from}"/>}
	end
end