Class: Ncrack::XML::Address
- Inherits:
-
Object
- Object
- Ncrack::XML::Address
- Defined in:
- lib/ncrack/xml/address.rb
Overview
Represents a address
XML element.
Constant Summary collapse
- TYPES =
Mapping of
addrtype
values to Symbols. { 'ipv4' => :ipv4, 'ipv6' => :ipv6 }
Instance Method Summary collapse
-
#addr ⇒ String
The IP of the address.
-
#initialize(node) ⇒ Address
constructor
private
Initializes the address object.
-
#ipv4? ⇒ Boolean
Determines whether the address is IPv4 or IPv6.
-
#ipv6? ⇒ Boolean
Determines whether the address is IPv6 or IPv4.
-
#to_s ⇒ String
Converts the address to a String.
-
#type ⇒ :ipv4, ...
The IP address type.
Constructor Details
#initialize(node) ⇒ Address
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the address object.
16 17 18 |
# File 'lib/ncrack/xml/address.rb', line 16 def initialize(node) @node = node end |
Instance Method Details
#addr ⇒ String
The IP of the address.
26 27 28 |
# File 'lib/ncrack/xml/address.rb', line 26 def addr @addr ||= @node['addr'] end |
#ipv4? ⇒ Boolean
Determines whether the address is IPv4 or IPv6.
54 55 56 |
# File 'lib/ncrack/xml/address.rb', line 54 def ipv4? type == :ipv4 end |
#ipv6? ⇒ Boolean
Determines whether the address is IPv6 or IPv4.
63 64 65 |
# File 'lib/ncrack/xml/address.rb', line 63 def ipv6? type == :ipv6 end |
#to_s ⇒ String
Converts the address to a String.
73 74 75 |
# File 'lib/ncrack/xml/address.rb', line 73 def to_s addr.to_s end |
#type ⇒ :ipv4, ...
The IP address type.
42 43 44 45 46 47 |
# File 'lib/ncrack/xml/address.rb', line 42 def type @type ||= ( addrtype = @node['addrtype'] TYPES.fetch(addrtype,addrtype) ) end |