Class: SPF::Query::IP
- Inherits:
-
Object
- Object
- SPF::Query::IP
- Defined in:
- lib/spf/query/ip.rb
Overview
Represents an IP address in an SPF record.
Instance Attribute Summary collapse
-
#address ⇒ String
readonly
The address.
-
#cidr_length ⇒ Integer?
readonly
CIDR length.
Instance Method Summary collapse
-
#initialize(address, cidr_length = nil) ⇒ IP
constructor
Initializes the IP.
-
#to_s ⇒ String
Converts the IP address to a String.
Constructor Details
#initialize(address, cidr_length = nil) ⇒ IP
Initializes the IP.
27 28 29 30 |
# File 'lib/spf/query/ip.rb', line 27 def initialize(address,cidr_length=nil) @address = address @cidr_length = cidr_length end |
Instance Attribute Details
#address ⇒ String (readonly)
The address.
11 12 13 |
# File 'lib/spf/query/ip.rb', line 11 def address @address end |
#cidr_length ⇒ Integer? (readonly)
CIDR length.
16 17 18 |
# File 'lib/spf/query/ip.rb', line 16 def cidr_length @cidr_length end |
Instance Method Details
#to_s ⇒ String
Converts the IP address to a String.
37 38 39 40 41 |
# File 'lib/spf/query/ip.rb', line 37 def to_s if @cidr_length then "#{@address}/#{@cidr_length}" else "#{@address}" end end |