Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Socket::Option#data

sockopt.data => string

returns the socket option data as a string.

Example
p Socket::Option.new(:INET6, :IPV6, :RECVPKTINFO, [1].pack("i!")).data
#=> "\x01\x00\x00\x00"
See also #byte #family #bool #inspect also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0