Sha256: b1ac35ed7374da77a5a03efa898802424448abd176de2d7e141e4977d7ad439b
Contents?: true
Size: 628 Bytes
Versions: 1
Compression:
Stored size: 628 Bytes
Contents
# frozen_string_literal: true require 'bindata' require 'pio/mac' require 'pio/monkey_patch/integer' require 'pio/monkey_patch/uint' module Pio module Type # MAC address class MacAddress < BinData::Primitive array :octets, type: :uint8, initial_length: 6 def set(value) self.octets = Mac.new(value).to_a end def get Mac.new(octets.reduce('') do |str, each| str + format('%02x', each) end.hex) end def to_bytes octets.map(&:to_hex).join(', ') end def inspect %("#{get}") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pio-0.30.2 | lib/pio/type/mac_address.rb |