Method: IPCat::IPRange#initialize

Defined in:
lib/ipcat/iprange.rb

#initialize(first, last, name = nil, url = nil) ⇒ IPRange

Returns a new instance of IPRange.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
# File 'lib/ipcat/iprange.rb', line 7

def initialize(first, last, name = nil, url = nil)
  @first = IPCat.ip_to_integer(first)
  @last  = IPCat.ip_to_integer(last)
  @name = name
  @url = url
  raise ArgumentError, 'first must be <= last' if @first > @last
end