Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

guid_spanner

Travis Status Maintainability Test Coverage Gem Version

Packs and unpacks 32(compact) and 36 charactor GUIDs

Install

require 'guid_spanner'
bundle

Usage

Unpack a 32 GUID to 36

GuidSpanner::Guid.unpack_to_36('1be7eaa5aba341e895a653e66be98fef')
=> '1be7eaa5-aba3-41e8-95a6-53e66be98fef'

Pack a 36 char GUID to 32

GuidSpanner::Guid.pack_to_32('1be7eaa5-aba3-41e8-95a6-53e66be98fef')
=> '1be7eaa5aba341e895a653e66be98fef'

Convert a 36 char GUID to binary

GuidSpanner::Guid.str_to_bin('1be7eaa5-aba3-41e8-95a6-53e66be98fef')
=> '\e\xE7\xEA\xA5\xAB\xA3A\xE8\x95\xA6S\xE6k\xE9\x8F\xEF'

Convert a binary GUID to 36 char

GuidSpanner::Guid.bin_to_str('\e\xE7\xEA\xA5\xAB\xA3A\xE8\x95\xA6S\xE6k\xE9\x8F\xEF')
=> '1be7eaa5-aba3-41e8-95a6-53e66be98fef'

Exceptions

Raises

GuidSpanner::Exceptions::InvalidUuidFormatError

if an incorrectly formatted GUID is provided for packing or unpacking or conversion

Licence

Guid Spanner is licensed under the Apache-2.0 licence.

Copyright (c) 2018 Sage Group Plc. All rights reserved.

About

Packs, unpacks and converts 32 and 36 bit and binary uuids

Resources

Stars

0 stars

Watchers

13 watching

Forks

Releases

Packages

Contributors

Languages