Hi, is there any cool way in Ruby to match two IPv6 that have the same
binary
value? For example:
2001:0DB8:0:0::0:1428:57ab
is the same as:
2001:0DB8:0::0:1428:57ab
Can Ruby match those two IPv6 easily without abing to parse manually
them?
Thanks for any suggestion.
From: Iñaki Baz C. [mailto:[email protected]]
Hi, is there any cool way in Ruby to match two IPv6 that have
the same binary value? For example:
2001:0DB8:0:0::0:1428:57ab
is the same as:
2001:0DB8:0::0:1428:57ab
Can Ruby match those two IPv6 easily without abing to parse
manually them?
require ‘ipaddr’
#=> true
ip1= IPAddr.new “2001:0DB8:0:0::0:1428:57ab”
#=> #<IPAddr:
IPv6:2001:0db8:0000:0000:0000:0000:1428:57ab/ffff:ffff:ffff:ffff:f
fff:ffff:ffff:ffff>
ip2= IPAddr.new “2001:0DB8:0::0:1428:57ab”
#=> #<IPAddr:
IPv6:2001:0db8:0000:0000:0000:0000:1428:57ab/ffff:ffff:ffff:ffff:f
fff:ffff:ffff:ffff>
ip1==ip2
#=> true
kind regards -botp
2008/6/17, Peña, Botp [email protected]:
ip1==ip2
#=> true
Terribly great !
Thanks.