mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-12 08:41:23 -05:00
0398ab7514
first FEATURE: allow admins to search users using IP ranges
16 lines
204 B
Ruby
16 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
|