Sha256: cd8ef609b85070107b9379ab8333df114bf33e719f31d3a7e650b5faf87e2cea

Contents?: true

Size: 362 Bytes

Versions: 2

Compression:

Stored size: 362 Bytes

Contents

require 'bindata'
require 'pio/ipv4_address'

module Pio
  module Type
    # IP address
    class IpAddress < BinData::Primitive
      array :octets, type: :uint8, initial_length: 4

      def set(value)
        self.octets = value
      end

      def get
        IPv4Address.new octets.map { | each | format('%d', each) }.join('.')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pio-0.9.0 lib/pio/type/ip_address.rb
pio-0.8.2 lib/pio/type/ip_address.rb