Sha256: 29d625b9946f732f6aaa16a543a37caac23f1536e8629d1820fb7d0e9dc97406

Contents?: true

Size: 418 Bytes

Versions: 1

Compression:

Stored size: 418 Bytes

Contents

# frozen_string_literal: true

require 'bindata'
require 'ipaddr'

module Pio
  module Type
    # IPv6 address
    class Ipv6Address < BinData::Primitive
      endian :big

      uint128 :ipv6_address

      def set(value)
        self.ipv6_address = IPAddr.new(value, Socket::Constants::AF_INET6)
      end

      def get
        IPAddr.new(ipv6_address, Socket::Constants::AF_INET6).to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.30.2 lib/pio/type/ipv6_address.rb