Method: IPAddress::IPv4#bits

Defined in:
lib/ipaddress_2/ipv4.rb

#bitsObject

Returns the address portion of an IP in binary format, as a string containing a sequence of 0 and 1

ip = IPAddress("127.0.0.1")

ip.bits
  #=> "01111111000000000000000000000001"


328
329
330
# File 'lib/ipaddress_2/ipv4.rb', line 328

def bits
  data.unpack("B*").first
end