uuid_v7 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0b79c3cd9c0cd1dad99619dcbb37dd0a5cc1712a188014f1e5a0eee95c43b93
4
- data.tar.gz: b72f39e7cc10d06ce8bdafdf158f568255ce789c8e5e1e8a256e183b08b01a2e
3
+ metadata.gz: b03f6464dc27d2ca7f41c132d4d69064e70cb06edfac6f25b4f9ac6a3a60ca99
4
+ data.tar.gz: ee687a53b8432216dcaa3145d4535bfc50a86bebbffdc0fa90c3f56f3eeda9ac
5
5
  SHA512:
6
- metadata.gz: 3c736d55b8bae705dbf4403598fbda318cdf6ddfef13dbb8979ae3c6349b4857bb0c896f7abd2eee712a3ad013e976358202cb6cbfa6a81414ca41c482ce4f75
7
- data.tar.gz: e0b940d2ad31422b5eeabd831653a05ec4a7ba6f86309e006a4c412eab0208c97f112a1edb54f91f9e3ca38827fa54d88d869283e6be08834fe90f51b03cb48b
6
+ metadata.gz: fb064229af5d3945159946211e6f34a07395a6c8e0eb772af3d181d893783c96c560e14397d6071523a40119092709bb4ae02eaf9fe8f8ffd6bf8ab25398aebb
7
+ data.tar.gz: c9b7a3c09120b189eab096d07cf4afe23193706d23507270c27b627f0910615c694929baa0425999ee96a2e53f0c80dff6fd67f770a3f418d81460fbbfc3ec53
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.5] - 2024-07-15
4
+
5
+ - Rails 8.0 brings some changes, the data is correctly recorded as BINARY in SQLite, so we can simplify the code, but too stay compatible the code is less simple.
6
+
3
7
  ## [0.1.4] - 2024-07-10
4
8
 
5
9
  - Relax Gem Spec Constraints
@@ -5,11 +5,19 @@ require_relative "base"
5
5
  module UuidV7
6
6
  module Types
7
7
  class SqliteType < Base
8
- # SQLite does not return binary data, it returns a String, no need to unpack it.
8
+ # In some configuration SQLite does not return binary data, it returns a String, in that case no need to unpack it.
9
+ # However, in some other configurations, it returns binary data, in that case we need to unpack it. activemodel (8.0.0)
10
+ # Note: If you are using SQLite3 >= 2.2, and Rails >= 8.0 you can get rid of this method all together.
9
11
  def deserialize(value)
10
12
  return unless value
11
13
 
12
- cast(value)
14
+ if value.is_a?(String) && value.encoding == Encoding::ASCII_8BIT && !value.match?(/\A\h{8}\h{4}\h{4}\h{4}\h{12}\z/)
15
+ # The value is binary encoded; unpack it
16
+ cast(value.unpack1("H*"))
17
+ else
18
+ # The value is a plain hex string; use it directly
19
+ cast(value)
20
+ end
13
21
  end
14
22
  end
15
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UuidV7
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuid_v7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Azemar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-14 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel