tiny_gid 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +9 -0
  3. data/lib/tiny_gid.rb +14 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 130f3c30c294915e45b4e64855cb034edc093deebd77ffdad98211a662660f55
4
- data.tar.gz: 06d162d16c28dd28909678ce9460a0ec9eaac623f5b3d3271effbfbb6bd3922a
3
+ metadata.gz: 47d930f4fc7a4bf64f70469a37c47ef8260ea708b698b3316b5e8d5853e0a15b
4
+ data.tar.gz: 96fca70d0822cb8f642c6037cc156d930d3312112e225fe2673eae68d62d1012
5
5
  SHA512:
6
- metadata.gz: 3f1c12bb235c2aa48d7cb04ea936dcb08ccb84c0a730c6ca76b843702cf8e082244b156add8cc30eeb9ef8dfe4281c2a356bb596be313b7243ec7553cae1ca56
7
- data.tar.gz: 40acfc1aa249e17d6ba544b59e2307742fd48db6f3478ff2e1d2a0e97c982d7c383702a77ebca0dc5980e9ead8ec0d124a8dd793f90162cd82ac10a5cdaae761
6
+ metadata.gz: 3a53ce651ae1a455e5f2950c2cfac63b7e2b9a382bd1ff1bbc667df8e85b1e823a0f5c4393da8ef923561f9e5d955b328a520f295ad2446dd0e289a123d32f92
7
+ data.tar.gz: 644f888231bcf5e2ab7b1b54ab1b69c9ff3e383cfc46eba4f9a0168a1d2b793e1a6c1f65264d3d67bad5a91c1c292a4360899967f069c7973236b19178bbb810
data/Changes CHANGED
@@ -1,3 +1,12 @@
1
+ v0.1.2 2026-04-19
2
+ --------------------
3
+ Add #parse and #to_sc methods to TinyGID (were only class methods prior)
4
+ Fix raise ArgumentError call in initialize()
5
+
6
+ v0.1.1 2026-03-01
7
+ --------------------
8
+ Fix TinyGID.app: don't assume Rails.application.name is defined
9
+
1
10
  v0.1.0 2025-12-31
2
11
  --------------------
3
12
  Make TinyGID a class not a module
data/lib/tiny_gid.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require "uri"
4
4
 
5
5
  class TinyGID
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.2"
7
7
  FORMAT = "gid://%s/%s/%s"
8
8
  REGEX = %r{\Agid://([^/]+)/([^/]+)/([^/?]+)(?:\?(.*?))?\z}
9
9
 
@@ -58,7 +58,7 @@ class TinyGID
58
58
  Thread.current[:__tiny_gid_app__]
59
59
  when @app
60
60
  @app
61
- when defined?(Rails) && Rails.respond_to?(:application)
61
+ when defined?(Rails) && Rails.respond_to?(:application) && Rails.application.respond_to?(:name)
62
62
  Rails.application.name
63
63
  end
64
64
  end
@@ -77,10 +77,21 @@ class TinyGID
77
77
  end
78
78
 
79
79
  def initialize(app)
80
- raise ArgumentError "app required" if app.to_s.strip.empty?
80
+ raise ArgumentError, "app required" if app.to_s.strip.empty?
81
81
  @app = app
82
82
  end
83
83
 
84
+ def parse(gid)
85
+ parsed = TinyGID.parse(gid)
86
+ raise ArgumentError, "gid contains the wrong app: '#{parsed[0]}' must be '#@app'" unless parsed[0] == @app
87
+
88
+ parsed
89
+ end
90
+
91
+ def to_sc(gid)
92
+ TinyGID.to_sc(gid)
93
+ end
94
+
84
95
  def method_missing(name, *arguments, &block)
85
96
  id = arguments.shift
86
97
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_gid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-31 00:00:00.000000000 Z
11
+ date: 2026-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec