Sha256: 6b6870d5f94306d4491d19283ef154ca1d05724636eaa498fe063612fdf900d4

Contents?: true

Size: 381 Bytes

Versions: 6

Compression:

Stored size: 381 Bytes

Contents

# encoding: utf-8

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

6 entries across 6 versions & 1 rubygems

Version Path
pio-0.8.1 lib/pio/type/ip_address.rb
pio-0.8.0 lib/pio/type/ip_address.rb
pio-0.7.0 lib/pio/type/ip_address.rb
pio-0.6.0 lib/pio/type/ip_address.rb
pio-0.5.0 lib/pio/type/ip_address.rb
pio-0.4.0 lib/pio/type/ip_address.rb