Project

typeid

0.01
No release in over a year
A type-safe, K-sortable, globally unique identifier inspired by Stripe IDs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0
~> 0.14.2
~> 3.12
~> 0.22.0

Runtime

~> 0.2.0
 Project Readme

TypeID Ruby

A Ruby implementation of TypeIDs

Gem Version RubyDoc Main codecov License

TypeIDs are a modern, type-safe, globally unique identifier based on the upcoming UUIDv7 standard. They provide a ton of nice properties that make them a great choice as the primary identifiers for your data in a database, APIs, and distributed systems. Read more about TypeIDs in their spec.

This particular implementation provides a Ruby library for generating and parsing TypeIDs.

Installation

If using bundler

bundle add typeid

If not

gem install typeid

Usage

require "typeid"                        #=> true

id = TypeID.new("user")                 #=> #<TypeID user_01h46z1k2cf2av8mp4r7we4697>
id.to_s                                 #=> user_01h46z1k2cf2av8mp4r7we4697

other_id = TypeID.from_string(id.to_s)  #=> #<TypeID user_01h46z1k2cf2av8mp4r7we4697>
id == other_id                          #=> true

Attributions

This gem depends on uuid7 by sprql.