ipaddr icon indicating copy to clipboard operation
ipaddr copied to clipboard

Add IPAddr#+/-

Open taketo1113 opened this issue 6 months ago • 5 comments

Add +/- methods to get an ipaddr instance greater/less than the original address by offset. the current IPAddr#succ only return next address, this IPAddr#+ return any address with offset.

addr = IPAddr.new("192.168.1.10")

addr + 10
=> #<IPAddr: IPv4:192.168.1.20/255.255.255.255>


(addr + 10).to_s
=> "192.168.1.20"

taketo1113 avatar Aug 07 '24 10:08 taketo1113