lib/ipaddress/ipv4.rb
def split(subnets=2)
      unless (1..(2**@prefix.host_prefix)).include? subnets
        raise ArgumentError, "Value #{subnets} out of range" 
      end
      networks = subnet(newprefix(subnets))
      until networks.size == subnets
        networks = sum_first_found(networks)
      end
      return networks
    end
def split(subnets=2)
      unless (1..(2**@prefix.host_prefix)).include? subnets
        raise ArgumentError, "Value #{subnets} out of range" 
      end
      networks = subnet(newprefix(subnets))
      until networks.size == subnets
        networks = sum_first_found(networks)
      end
      return networks
    end
def split ( subnets = 2 ) unless ( 1 .. ( 2 ** @prefix . host_prefix ) ) . include? subnets raise ArgumentError , "Value #{subnets} out of range" end networks = subnet ( newprefix ( subnets ) ) until networks . size == subnets networks = sum_first_found ( networks ) end return networks end
Splits a network into different subnets

 If the IP Address is a network, it can be divided into
 multiple networks. If +self+ is not a network, this
 method will calculate the network from the IP and then
 subnet it.

 If +subnets+ is an power of two number, the resulting
 networks will be divided evenly from the supernet.

   network = IPAddress("172.16.10.0/24")

   network / 4   # implies map{|i| i.to_string}
     #=> ["172.16.10.0/26",
     #=>  "172.16.10.64/26",
     #=>  "172.16.10.128/26",
     #=>  "172.16.10.192/26"]

 If +num+ is any other number, the supernet will be
 divided into some networks with a even number of hosts and
 other networks with the remaining addresses.

   network = IPAddress("172.16.10.0/24")

   network / 3   # implies map{|i| i.to_string}
     #=> ["172.16.10.0/26",
     #=>  "172.16.10.64/26",
     #=>  "172.16.10.128/25"]

 Returns an array of IPv4 objects
Splits a network into different subnets