From: Jos Backus Date: 2007-03-22T13:02:55+09:00 Subject: Re: Extensions to ipaddr.rb An IPAddr.entries instance method method that enumerates the IP addresses would also be useful. E.g. for IPv4: lizzy:~% cat ip.rb #!/usr/bin/env ruby require 'ipaddr' class IPAddr def entries list = [] 0.upto(~@mask_addr & IN4MASK) do |i| list << IPAddr.new(_to_string(@addr + i)) end list end end ip = IPAddr.new("192.168.5.0/28") ip.entries.each do |ip| puts ip end lizzy:~% ruby ip.rb 192.168.5.0 192.168.5.1 192.168.5.2 192.168.5.3 192.168.5.4 192.168.5.5 192.168.5.6 192.168.5.7 192.168.5.8 192.168.5.9 192.168.5.10 192.168.5.11 192.168.5.12 192.168.5.13 192.168.5.14 192.168.5.15 lizzy:~% -- Jos Backus jos at catnook.com