def fill_in(list, options=nil)
known_args = [:Objectify, :Short]
short = false
objectify = false
raise ArgumentError, "Array expected for argument 'list' but #{list.class} provided." if (!list.kind_of?(Array) )
if (options)
raise ArgumentError, "Hash expected for argument 'options' but " +
"#{options.class} provided." if (!options.kind_of?(Hash) )
NetAddr.validate_args(options.keys,known_args)
if (options.has_key?(:Short) && options[:Short] == true)
short = true
end
if (options.has_key?(:Objectify) && options[:Objectify] == true)
objectify = true
end
end
cidr_list = []
list.each do |obj|
if (!obj.kind_of?(NetAddr::CIDR))
begin
obj = NetAddr::CIDR.create(obj)
rescue Exception => error
aise ArgumentError, "A provided CIDR raised the following " +
"errors: #{error}"
end
end
if (!obj.version == self.version)
raise VersionError, "#{obj.desc(:Short => true)} is not a version #{self.version} address."
end
if ( self.contains?(obj) == false )
raise "#{obj.desc(:Short => true)} does not fit " +
"within the bounds of #{self.desc(:Short => true)}."
end
cidr_list.push(obj)
end
complete_list = NetAddr.cidr_fill_in(self,cidr_list)
if (!objectify)
subnets = []
complete_list.each {|entry| subnets.push(entry.desc(:Short => short))}
return(subnets)
else
return(complete_list)
end
end