Skip to content

Instantly share code, notes, and snippets.

@SegFaultAX
Created March 20, 2015 02:46
Show Gist options
  • Save SegFaultAX/4906429beff41460e6de to your computer and use it in GitHub Desktop.
Save SegFaultAX/4906429beff41460e6de to your computer and use it in GitHub Desktop.
IPAddr prefix length hack
class OTIPAddr < IPAddr
attr_reader :mask_addr
def prefix_len
@mask_addr.to_s(2).count "1"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment