module UpilUtils

This module is part of the Ruby Wrapper for a C Upil Library. It is composed of “Utils”. This module is not required for using the wrapper but it provides static methods that can be useful to manipulate Upil types. Feel free to mofify this module adding your own Upil Utils.

Public Instance Methods

UpilBuffer_from_unsigned_char_array(unsigned_char_array) click to toggle source
# File lib/upil_utils.rb, line 13
def UpilBuffer_from_unsigned_char_array(unsigned_char_array)
    ubuffer = nil;
    if (!unsigned_char_array.is_a?(Array))
        raise "The Argument is not an Array"
    else
        ubuffer = UpilBuffer.new(unsigned_char_array.pack('C*'))
    end
    return ubuffer
end
to_unsigned_char_array(ubuffer) click to toggle source
# File lib/upil_utils.rb, line 23
def to_unsigned_char_array(ubuffer)
    if (!ubuffer.is_a?(UpilBuffer))
        raise "The Argument is not an UpilBuffer"
    else
        ubuffer = (ubuffer.to_string).unpack('C*')
    end
end