Class: SPF::Query::IP

Inherits:
Object
  • Object
show all
Defined in:
lib/spf/query/ip.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, cidr_length = nil) ⇒ IP

Returns a new instance of IP.



9
10
11
12
# File 'lib/spf/query/ip.rb', line 9

def initialize(address,cidr_length=nil)
  @address     = address
  @cidr_length = cidr_length
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



5
6
7
# File 'lib/spf/query/ip.rb', line 5

def address
  @address
end

#cidr_lengthObject (readonly)

Returns the value of attribute cidr_length.



7
8
9
# File 'lib/spf/query/ip.rb', line 7

def cidr_length
  @cidr_length
end

Instance Method Details

#to_sObject



14
15
16
17
18
# File 'lib/spf/query/ip.rb', line 14

def to_s
  if @cidr_length then "#{@address}/#{@cidr_length}"
  else                 "#{@address}"
  end
end