Refactor string_to_cidr method. Relates to #11552

Removes unnecessary check for string.nil? and is rescues from [IPAddr::InvalidAddressError](http://www.ruby-doc.org/stdlib-2.0/libdoc/ipaddr/rdoc/IPAddr/InvalidAddressError.html) instead of ArgumentError