class Dastbytes::Binary

Public Class Methods

pack( type, value ) click to toggle source
# File lib/dastbytes/binary.rb, line 3
def self.pack( type, value )
  values = [ value ]
  case type
  when :uint8
    values.pack( "C*" )
  when :uint16
    values.pack( "v*" )
  when :uint32
    values.pack( "V*" )
  end
end
unpack( type, value ) click to toggle source
# File lib/dastbytes/binary.rb, line 15
def self.unpack( type, value )
  case type
  when :uint8
    value.unpack( "C*" )
  when :uint16
    value.unpack( "v*" )
  when :uint32
    value.unpack( "V*" )
  end
end