# File lib/cidr.rb, line 451 def [](index) raise ArgumentError, "Integer expected for argument 'index' but " + "#{index.class} provided." if (!index.kind_of?(Integer) ) addr = @network + index if ( (@hostmask | addr) == (@hostmask | @network) ) addr = NetAddr.cidr_build(@version, addr) else raise BoundaryError, "Index of #{index} returns IP that is out of " + "bounds of CIDR network." end return(addr) end