validates_identity-cl_rut 1.0.0 → 1.0.1

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: 23904a4d88d88455c025369dfe72997dd3753188712b8cd1251a08661c97d50b
4
- data.tar.gz: d8fa1d92e25e81f4520b9dda049d0f69e848b3eaa3459b8b249d357a2ba86df5
3
+ metadata.gz: a75201b55b1384590c48708ce04ed5a256b41d513f4cce6e1e641ad62ac0e9cc
4
+ data.tar.gz: b9d9af6a9917da69f7052668cb7c27ddade19d2810f597b90e98da198a75914f
5
5
  SHA512:
6
- metadata.gz: 2933d1dc6b72b47d9f0ecae28e87f3ec14c88d5b8231954382b29946e19f69cbd5f049a1c17b65644be1bfc287c04e522d66bbb0a6ac5d77c48f05707cab93b0
7
- data.tar.gz: 39a01bc6c92dc4e855e733ec33007986d67d6048e393adb3a8f7abef20018ad1cb050920d15c680a9801005c224e66365a5026ec118b7d93821bab11f34d3ee3
6
+ metadata.gz: 41e8c7fc228d8a0c9009f88454f2252c554a78454f07b46afbef64018c2e6c54a6a41ed09da26415b5d9d33fef4a6194afae2a4e89ac14e5823c74663a729ded
7
+ data.tar.gz: 547a4138ce702874d92381ec67e82746877e5ea05beb60609febaa0c48dff860a35ce4a8838c75025906bad5829bf38360c18debd5ada2742217ac7b9dd35b74
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [1.0.1] - 2026-03-20
2
+
3
+ ### Added
4
+
5
+ - CL_RUT_LEGAL identity type
6
+ - CL_RUT_PERSON identity type
7
+
8
+ ### Fixed
9
+
10
+ - 7-digit Chilean RUT validation
11
+
1
12
  ## [1.0.0] - 2024-03-19
2
13
 
3
14
  ### Changed
@@ -3,7 +3,7 @@
3
3
  class ValidatesIdentity
4
4
  module ClRut
5
5
  class Validator
6
- VALIDATION_REGULAR_EXPRESSION = /^(\d{2})\.?(\d{3})\.?(\d{3})-?(\d{1}|K|k)$/.freeze
6
+ VALIDATION_REGULAR_EXPRESSION = /^(\d{1,2})\.?(\d{3})\.?(\d{3})-?(\d{1}|K|k)$/.freeze
7
7
 
8
8
  attr_reader :value
9
9
 
@@ -41,7 +41,8 @@ class ValidatesIdentity
41
41
  end
42
42
 
43
43
  def calculated_verifier_digit
44
- sum = multiply_and_sum([3, 2, 7, 6, 5, 4, 3, 2], number)
44
+ multipliers = (0...number.length).map { |i| [2, 3, 4, 5, 6, 7][i % 6] }.reverse
45
+ sum = multiply_and_sum(multipliers, number)
45
46
  rest = sum % 11
46
47
  difference = 11 - rest
47
48
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  class ValidatesIdentity
4
4
  module ClRut
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  end
7
7
  end
@@ -11,5 +11,10 @@ end
11
11
 
12
12
  # Person and Legal
13
13
  ValidatesIdentity.register_legal_identity_type('CL_RUT', ValidatesIdentity::ClRut::Validator)
14
- ValidatesIdentity::ShouldaMatchers.register_legal_allowed_values('CL_RUT', %w[760864285 76.086.428-5 220604497 22.060.449-7])
15
- ValidatesIdentity::ShouldaMatchers.register_legal_disallowed_values('CL_RUT', %w[76086428K 76.086.428-K 220604492 22.060.449-2])
14
+ ValidatesIdentity.register_person_identity_type('CL_RUT', ValidatesIdentity::ClRut::Validator)
15
+ ValidatesIdentity.register_legal_identity_type_alias('CL_RUT', 'CL_RUT_LEGAL')
16
+ ValidatesIdentity.register_person_identity_type_alias('CL_RUT', 'CL_RUT_PERSON')
17
+ ValidatesIdentity::ShouldaMatchers.register_legal_allowed_values('CL_RUT_LEGAL', %w[760864285 76.086.428-5 220604497 22.060.449-7])
18
+ ValidatesIdentity::ShouldaMatchers.register_legal_disallowed_values('CL_RUT_LEGAL', %w[76086428K 76.086.428-K 220604492 22.060.449-2])
19
+ ValidatesIdentity::ShouldaMatchers.register_person_allowed_values('CL_RUT_PERSON', %w[125319092 12.531.909-2 85490923 8.549.092-3])
20
+ ValidatesIdentity::ShouldaMatchers.register_person_disallowed_values('CL_RUT_PERSON', %w[12531909K 12.531.909-K 85490921 8.549.092-1])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validates_identity-cl_rut
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Ribeiro