I\'ve been using the ip-address gem and it doesn\'t seem to have the ability to convert from a netmask of the form
255.255.255.0
into the
Here is a way to do it without the IPAddr gem
(('1'*cidr)+('0'*(32-cidr))).scan(/.{8}/m).map{|e|e.to_i(2)}.join('.')