class Ncrack::XML::Address
Represents a ‘address` XML
element.
Constants
- TYPES
Mapping of ‘addrtype` values to Symbols.
Public Class Methods
new(node)
click to toggle source
Initializes the address object.
@param [Nokogiri::XML::Node] node
The XML node for the `address` XML element.
@api private
# File lib/ncrack/xml/address.rb, line 16 def initialize(node) @node = node end
Public Instance Methods
addr()
click to toggle source
The IP of the address.
@return [String]
The value of the `addr` attribute.
# File lib/ncrack/xml/address.rb, line 26 def addr @addr ||= @node['addr'] end
ipv4?()
click to toggle source
Determines whether the address is IPv4 or IPv6.
@return [Boolean]
# File lib/ncrack/xml/address.rb, line 54 def ipv4? type == :ipv4 end
ipv6?()
click to toggle source
Determines whether the address is IPv6 or IPv4.
@return [Boolean]
# File lib/ncrack/xml/address.rb, line 63 def ipv6? type == :ipv6 end
to_s()
click to toggle source
Converts the address to a String.
@return [String]
The IP of the address.
# File lib/ncrack/xml/address.rb, line 73 def to_s addr.to_s end
type()
click to toggle source
The IP address type.
@return [:ipv4, :ipv6, String]
The value of the `addrtype` attribute.
# File lib/ncrack/xml/address.rb, line 42 def type @type ||= ( addrtype = @node['addrtype'] TYPES.fetch(addrtype,addrtype) ) end