ulid-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/lib/ulid.rb +2 -2
- data/lib/ulid/version.rb +1 -1
- data/ulid-ruby.gemspec +8 -3
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8396615efbd1df02008002962daa558d35055a4
|
4
|
+
data.tar.gz: f941d284e3b2016ff39beb8cabf1f8f278e7adf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcf9a90061bb217099b723dc60045f709d261697f76deef858b5397def088b7ce0c21ae1ab33bf77aae9a08287223d5e6b7b6a519d0bc0aa5ba666b6561d510e
|
7
|
+
data.tar.gz: 2c09e47a2e235835fe1588dbeba56f7e89de60dfd00660a4ef348c6bd819df78d53ea4b5e73f5aa06a717fe3c3b15605d2e19fadfccf3a51e20330f5931d2da3
|
data/README.md
CHANGED
@@ -11,11 +11,13 @@
|
|
11
11
|
|
12
12
|
# ULID
|
13
13
|
|
14
|
-
A ULID is a "Universally Unique Lexicographically-sortable Identifier."
|
14
|
+
A ULID is a "Universally Unique Lexicographically-sortable Identifier." In its string form, a ULID is a compact, URL-friendly, Base32, unique ID string that encodes its time of creation and sorts according the time value it encodes. [Crockford's Base32](https://en.wikipedia.org/wiki/Base32#Crockford.27s_Base32) alphabet is used in encoding because it's easy to sort, unambiguous in its choice of letters, and like most Base32 encoding schemes is case-insensitive.
|
15
15
|
|
16
|
-
**NOTE:** while the ULID values generated are compatible with the existing Ruby ULID library located at https://github.com/rafaelsales/ulid, this library is not code-compatible. I needed some additional features for a project and it was easier to just rebuild the functionality. May not be useful for anyone else but it's working for us in production at https://io.adafruit.com.
|
17
16
|
|
18
|
-
|
17
|
+
This is a thin Ruby library for generating and parsing ULID values. This code is based on the original concept presented at https://github.com/alizain/ulid and in part based on code from the C# and Go projects at https://github.com/RobThree/NUlid and https://github.com/oklog/ulid respectively.
|
18
|
+
|
19
|
+
**NOTE:** while the ULID values generated are compatible with the existing Ruby ULID library located at https://github.com/rafaelsales/ulid, this library is not code-compatible and it provides additinal features. While working on Adafruit IO, we needed to generate time-based, lexicographically sortable IDs _and_ we needed to be able to get the time value back out. At one point we used Cassandra and its native Time UUID type, but that didn't translate well to DynamoDB and its use of sort keys. ULIDs were found to be an acceptable choice and it was easier to just rebuild the existing functionality of [rafaelsales/ulid](https://github.com/rafaelsales/ulid) while adding parsing. This tool may not be useful for anyone else but it's working for us in production at https://io.adafruit.com.
|
20
|
+
|
19
21
|
|
20
22
|
A ULID string looks like this:
|
21
23
|
|
@@ -33,6 +35,7 @@ The two parts of a ULID are **Timestamp** and **Entropy**.
|
|
33
35
|
Timestamp Entropy
|
34
36
|
48bits 80bits
|
35
37
|
|
38
|
+
|
36
39
|
### Timestamp
|
37
40
|
|
38
41
|
- Encoded in first 48 bits of ULID. In Base32 it's the first 10 ASCII characters.
|
data/lib/ulid.rb
CHANGED
@@ -19,8 +19,8 @@ module ULID
|
|
19
19
|
# @example Generate a ULID
|
20
20
|
# ULID.new #=> #<ULID::Identifier:0x007f83f90aecc0 ....>
|
21
21
|
#
|
22
|
-
def self.new
|
23
|
-
Identifier.new
|
22
|
+
def self.new(*args)
|
23
|
+
Identifier.new(*args)
|
24
24
|
end
|
25
25
|
|
26
26
|
# Get a new, randomized ULID string at the current time.
|
data/lib/ulid/version.rb
CHANGED
data/ulid-ruby.gemspec
CHANGED
@@ -6,11 +6,16 @@ require 'ulid/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "ulid-ruby"
|
8
8
|
spec.version = ULID::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Adam Bachman"]
|
10
10
|
spec.email = ["adam.bachman@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
12
|
+
spec.summary = %q{Ruby library providing support for Universally unique Lexicographically sortable IDentifiers}
|
13
|
+
spec.description = %q{
|
14
|
+
Ruby library providing support for Universally unique Lexicographically
|
15
|
+
Sortable Identifiers. ULIDs are helpful in systems where you need to
|
16
|
+
generate ID values that are absolutely lexicographically sortable by time,
|
17
|
+
regardless of where they were generated.
|
18
|
+
}
|
14
19
|
spec.homepage = "https://github.com/abachman/ulid-ruby"
|
15
20
|
spec.license = "mit"
|
16
21
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ulid-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Adam Bachman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
@@ -66,7 +66,10 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.9'
|
69
|
-
description:
|
69
|
+
description: "\n Ruby library providing support for Universally unique Lexicographically\n
|
70
|
+
\ Sortable Identifiers. ULIDs are helpful in systems where you need to\n generate
|
71
|
+
ID values that are absolutely lexicographically sortable by time,\n regardless
|
72
|
+
of where they were generated.\n "
|
70
73
|
email:
|
71
74
|
- adam.bachman@gmail.com
|
72
75
|
executables: []
|
@@ -116,6 +119,6 @@ rubyforge_project:
|
|
116
119
|
rubygems_version: 2.6.8
|
117
120
|
signing_key:
|
118
121
|
specification_version: 4
|
119
|
-
summary:
|
120
|
-
|
122
|
+
summary: Ruby library providing support for Universally unique Lexicographically sortable
|
123
|
+
IDentifiers
|
121
124
|
test_files: []
|