1 # frozen_string_literal: true
4 # Format an IPAddr the way PostgreSQL's inet type does: host addresses
5 # are shown bare, while networks carry their prefix length.
6 def acl_address(address)
7 return nil if address.nil?
9 host_prefix = address.ipv4? ? 32 : 128
11 if address.prefix == host_prefix
14 "#{address}/#{address.prefix}"