universalid 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 626443be00555a2fac0c698df128de29ad2169003bc293e1e1df63ff83cfaf19
4
- data.tar.gz: d4f5f42845c42332abbe2b64e5a2fa4139f08e457f9766cce700735003d88e02
3
+ metadata.gz: 8adc71d500029efbc4c0c388042413a4676c101da9f2390a300134a6bde37386
4
+ data.tar.gz: be284fbc808de8624d2ae7b622439380785af1bce3c50d5bb2f80e229472a1c2
5
5
  SHA512:
6
- metadata.gz: e52fef154f9e9dd5660d413707cb2b05619cde795aaf9034ddc311bebe699a40332be0cdc638cc5305bd357473a61f96c15855f88cad8e0e0cbfe33ce56bfb49
7
- data.tar.gz: 65f63606908e4a22117285d463b5d96878108320ee92fba133d22ec0fe4f8673cddab66a6a61e95fc3a3bf1e876364d03ee2de3541473da8b3f169899cd865bd
6
+ metadata.gz: 2b40d14b7e93f5559fb5b24f9f47be634a03e083f7d335e951ac9ade937ceca6fc5e382c7e208dcf04d4cd7ab7bb8f0c6ff16748900bca67b60d534afea25651
7
+ data.tar.gz: 5a15af009bb6a4ea4a148c0787d46b94e795a3debed2af7e9d986a0c0b00b48177fd178653c075a6f28874cb8fc91a3d6446b7a3b891294c396ad0a2538449e4
data/README.md CHANGED
@@ -206,6 +206,8 @@ The following extension datatypes ship with Universal ID:
206
206
 
207
207
  - `ActiveRecord::Base`
208
208
  - `ActiveRecord::Relation`
209
+ - `ActiveSupport::Cache::Entry`
210
+ - `ActiveSupport::Cache::Store`
209
211
  - `ActiveSupport::TimeWithZone`
210
212
  - `GlobalID`
211
213
  - `SignedGlobalID`
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ if defined? ActiveSupport::Cache::Entry
4
+
5
+ UniversalID::MessagePackFactory.register(
6
+ type: ActiveSupport::Cache::Entry,
7
+ packer: ->(obj, packer) do
8
+ packer.write obj.value
9
+ packer.write obj.version
10
+ packer.write obj.expires_at
11
+ end,
12
+ unpacker: ->(unpacker) do
13
+ value = unpacker.read
14
+ version = unpacker.read
15
+ expires_at = unpacker.read
16
+ ActiveSupport::Cache::Entry.new value, version: version, expires_at: expires_at
17
+ end
18
+ )
19
+
20
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ if defined? ActiveSupport::Cache::Store
4
+
5
+ UniversalID::MessagePackFactory.register(
6
+ type: ActiveSupport::Cache::Store,
7
+ packer: ->(obj, packer) do
8
+ packer.write obj.class.name
9
+ packer.write obj.options
10
+ packer.write obj.instance_variable_get(:@data)
11
+ end,
12
+ unpacker: ->(unpacker) do
13
+ class_name = unpacker.read
14
+ options = unpacker.read
15
+ data = unpacker.read
16
+ Object.const_get(class_name).new(options).tap do |store|
17
+ store.instance_variable_set :@data, data
18
+ end
19
+ end
20
+ )
21
+
22
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UniversalID
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universalid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Hopkins (hopsoft)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -365,6 +365,8 @@ files:
365
365
  - lib/universalid/extensions/active_record/base_packer.rb
366
366
  - lib/universalid/extensions/active_record/base_unpacker.rb
367
367
  - lib/universalid/extensions/active_record/relation_message_pack_type.rb
368
+ - lib/universalid/extensions/active_support/cache/entry_message_pack_type.rb
369
+ - lib/universalid/extensions/active_support/cache/store_message_pack_type.rb
368
370
  - lib/universalid/extensions/active_support/time_with_zone_message_pack_type.rb
369
371
  - lib/universalid/extensions/global_id/global_id_model.rb
370
372
  - lib/universalid/extensions/global_id/global_id_uid_extension.rb
@@ -418,7 +420,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
418
420
  - !ruby/object:Gem::Version
419
421
  version: '0'
420
422
  requirements: []
421
- rubygems_version: 3.5.3
423
+ rubygems_version: 3.2.32
422
424
  signing_key:
423
425
  specification_version: 4
424
426
  summary: Fast, recursive, optimized, URL-Safe serialization for any Ruby object