class ULID

Overview

this implements ULID generation, as defined at https://github.com/ulid/spec

Included Modules

Defined in:

ulid.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(value : String) #

[View source]
def self.new(uuid : UUID) #

[View source]
def self.new(value : UInt128) #

[View source]

Class Method Detail

def self.monotonic_string(seed_time : Time = Time.utc) #

[View source]
def self.monotonic_uint(seed_time : Time = Time.utc) #

[View source]
def self.monotonic_ulid(seed_time : Time = Time.utc) #

[View source]
def self.monotonic_uuid(seed_time : Time = Time.utc) #

[View source]
def self.string(seed_time : Time = Time.utc) #

[View source]
def self.uint(seed_time : Time = Time.utc) #

[View source]
def self.ulid(seed_time : Time = Time.utc) #

[View source]
def self.uuid(seed_time : Time = Time.utc) #

[View source]

Instance Method Detail

def <=>(other : ULID) #

implementing <=> and including Comparable will give us == for free


[View source]
def hash(hasher) #

Define a hash(hasher) method based on @value Between #hash and #==, we can use ULID objects as values in Hashes


[View source]
def to_i : UInt128 #

[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def to_u128 : UInt128 #

[View source]
def to_uuid #

[View source]
def value : UInt128 #

[View source]
def value=(value : UInt128) #

[View source]