2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00
discourse/lib/ip_addr.rb

17 lines
204 B
Ruby
Raw Normal View History

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