Class: IPAddr

Inherits:
Object
  • Object
show all
Defined in:
lib/clusterfuck/core_ext/ipaddr.rb

Instance Method Summary collapse

Instance Method Details

#addrObject



14
15
16
# File 'lib/clusterfuck/core_ext/ipaddr.rb', line 14

def addr
  to_string
end

#cidrObject



6
7
8
# File 'lib/clusterfuck/core_ext/ipaddr.rb', line 6

def cidr
  IPAddr.new(netmask).to_i.to_s(2).count("1")
end

#netmaskObject



2
3
4
# File 'lib/clusterfuck/core_ext/ipaddr.rb', line 2

def netmask
  _to_string(@mask_addr)
end

#to_cidrObject



10
11
12
# File 'lib/clusterfuck/core_ext/ipaddr.rb', line 10

def to_cidr
  to_string + "/" + cidr.to_s
end