End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
IPAddr#hton
hton
lib/ipaddr.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/ipaddr.rb, line 228
def hton
case @family
when Socket::AF_INET
return [@addr].pack('N')
when Socket::AF_INET6
return (0..7).map { |i|
(@addr >> (112 - 16 * i)) & 0xffff
}.pack('n8')
else
raise AddressFamilyError, "unsupported address family"
end
end
Returns a network byte ordered string form of the IP address.