Sha256: 40fb0bf480f40d06f47855dbe1dd3191092b852d5c85891f4ef85f4eaf7ee651
Contents?: true
Size: 547 Bytes
Versions: 25
Compression:
Stored size: 547 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 = IPv4Address.new(value).to_a end def get IPv4Address.new(octets.map { |each| format('%d', each) }.join('.')) end def >>(other) get.to_i >> other end def &(other) get.to_i & other end def ==(other) get == other end end end end
Version data entries
25 entries across 25 versions & 1 rubygems