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
If you don't need to use ip-address gem, you can do this with the netaddr gem
require 'netaddr' def to_cidr_mask(dotted_mask) NetAddr::CIDR.create('0.0.0.0/'+dotted_mask).netmask end to_cidr_mask("255.224.0.0") # => "/11"