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 +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/validates_identity/cl_rut/validator.rb +3 -2
- data/lib/validates_identity/cl_rut/version.rb +1 -1
- data/lib/validates_identity/cl_rut.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a75201b55b1384590c48708ce04ed5a256b41d513f4cce6e1e641ad62ac0e9cc
|
|
4
|
+
data.tar.gz: b9d9af6a9917da69f7052668cb7c27ddade19d2810f597b90e98da198a75914f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41e8c7fc228d8a0c9009f88454f2252c554a78454f07b46afbef64018c2e6c54a6a41ed09da26415b5d9d33fef4a6194afae2a4e89ac14e5823c74663a729ded
|
|
7
|
+
data.tar.gz: 547a4138ce702874d92381ec67e82746877e5ea05beb60609febaa0c48dff860a35ce4a8838c75025906bad5829bf38360c18debd5ada2742217ac7b9dd35b74
|
data/CHANGELOG.md
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
|
-
|
|
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
|
|
|
@@ -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
|
|
15
|
-
ValidatesIdentity
|
|
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])
|