Method: IPAddress::IPv6#bits

Defined in:
lib/ipaddress/ipv6.rb

#bitsObject

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

ip6 = IPAddress("2001:db8::8:800:200c:417a")

ip6.bits 
  #=> "0010000000000001000011011011100000 [...] "


503
504
505
# File 'lib/ipaddress/ipv6.rb', line 503

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