This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/lib/ip_addr.rb
Régis Hanol 0398ab7514 FIX: when adding an IP to the spammer list, check the broader ban list
first

FEATURE: allow admins to search users using IP ranges
2014-11-21 18:16:06 +01:00

17 lines
204 B
Ruby

class IPAddr
def to_cidr_s
if @addr
mask = @mask_addr.to_s(2).count('1')
if mask == 32
to_s
else
"#{to_s}/#{mask}"
end
else
nil
end
end
end