class SPF::Query::IP

Represents an IP address in an SPF record.

Attributes

address[R]

The address.

@return [String]

cidr_length[R]

CIDR length.

@return [Integer, nil]

Public Class Methods

new(address,cidr_length=nil) click to toggle source

Initializes the IP.

@param [String] address

The IP address.

@param [Integer, nil] cidr_length

Optional CIDR length.
# File lib/spf/query/ip.rb, line 27
def initialize(address,cidr_length=nil)
  @address     = address
  @cidr_length = cidr_length
end

Public Instance Methods

to_s() click to toggle source

Converts the IP address to a String.

@return [String]

# File lib/spf/query/ip.rb, line 37
def to_s
  if @cidr_length then "#{@address}/#{@cidr_length}"
  else                 "#{@address}"
  end
end