mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 16:46:19 +08:00
0398ab7514
first FEATURE: allow admins to search users using IP ranges
17 lines
204 B
Ruby
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
|