Markus Werner wrote: > Happy New Year Everyone, > > I seems for me that there is a bug (or a feature) in the standard lib > "ipaddr.rb". ;-) > > See irb output -> > > irb(main):001:0> require 'ipaddr' > => true > irb(main):002:0> ip1 = IPAddr.new("192.168.1.243/24") > => #<IPAddr: IPv4:192.168.1.0/255.255.255.0> > > IMHO should it be #<IPAddr: IPv4: 192.168.1.243/255.255.255.0> I think the problem is that technically there's no such address as 192.168.1.243/24, you just have 192.168.1.243 in the subnet 192.168.1.0/24. > And there should be methods to get the "net" and in case of ipv4 maybe > "broadcast" address of the prefix. I'd say it should use a different syntax if you want to designate the subnet too, IPAddr.new(192.168.1.243, 24) or then just provide a separate class Subnet. E