Method: Notable.mask_ip
- Defined in:
- lib/notable.rb
.mask_ip(ip) ⇒ Object
111 112 113 114 115 116 117 118 119 120 |
# File 'lib/notable.rb', line 111 def self.mask_ip(ip) addr = IPAddr.new(ip) if addr.ipv4? # set last octet to 0 addr.mask(24).to_s else # set last 80 bits to zeros addr.mask(48).to_s end end |