lib/spf/model.rb in spf-0.0.48 vs lib/spf/model.rb in spf-0.0.49
- old
+ new
@@ -463,13 +463,15 @@
def parse_params(required = true)
self.parse_ipv4_network(required)
if IP === @ip_network
@ip_netblocks << @ip_network
- @errors << SPF::InvalidMechCIDRError.new(
- "Invalid CIDR netblock - bits in host portion of address of #{@ip_network}"
- ) if @ip_network.offset != 0
+ if @ip_network.respond_to?(:offset) && @ip_network.offset != 0
+ @errors << SPF::InvalidMechCIDRError.new(
+ "Invalid CIDR netblock - bits in host portion of address of #{@ip_network}"
+ )
+ end
end
end
def params
return nil unless @ip_network
@@ -496,12 +498,14 @@
NAME = 'ip6'
def parse_params(required = true)
self.parse_ipv6_network(required)
@ip_netblocks << @ip_network if IP === @ip_network
- @errors << SPF::InvalidMechCIDRError.new(
- "Invalid CIDR netblock - bits in host portion of address of #{@ip_network}"
- ) if @ip_network.offset != 0
+ if @ip_network.respond_to?(:offset) && @ip_network.offset != 0
+ @errors << SPF::InvalidMechCIDRError.new(
+ "Invalid CIDR netblock - bits in host portion of address of #{@ip_network}"
+ )
+ end
end
def params
return nil unless @ip_network
return @ip_network if String === @ip_network