ci_uy 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ci_uy +8 -10
- data/lib/ci_uy.rb +7 -0
- metadata +10 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1388476217e551d47b5eb9c0d100790566d9e590646722705c7ec4990b1ee162
|
4
|
+
data.tar.gz: 1c329eed7b4e4af2866d9f401b18a24826ba8072517fa26bf45411a145d08136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6baf373a37bf4643c679b3d7c516b06652b32db8c294b0cebcc629b34f8e9aacaea6c4d2c8fe6f101443a27bccf9aa8c9c875dd0a959f02c2a30fd715762988f
|
7
|
+
data.tar.gz: f39c6b501a82d57b0d6796da1db2773521f71ff89cc2639da9f63edf1b4cf889bbd501f5af6ad5890edb0d817be3159b86eabbd87b1aa8c1494f84ec3e056ecd
|
data/bin/ci_uy
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
2
|
require 'ci_uy'
|
4
3
|
|
5
4
|
args = ARGV.dup
|
@@ -12,15 +11,14 @@ when ('random' || 'get_random_ci')
|
|
12
11
|
when ('validation_digit' || 'get_validation_digit')
|
13
12
|
puts CiUY.validation_digit args[1].dup
|
14
13
|
else
|
15
|
-
puts
|
14
|
+
puts <<-MANUAL
|
16
15
|
|
17
|
-
Usage:
|
18
|
-
|
16
|
+
Usage:
|
17
|
+
ci_uy [parameter[ci number]]
|
19
18
|
|
20
|
-
Possible parameters are:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
EOS
|
19
|
+
Possible parameters are:
|
20
|
+
validate [number] - validates given CI number, returns true or false
|
21
|
+
validation_digit [number] - returns validation digit for given number CI number
|
22
|
+
random - returns a random valid CI number.
|
23
|
+
MANUAL
|
26
24
|
end
|
data/lib/ci_uy.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# CiUY main validation. The gem receives a string and doesn't care what you use
|
2
|
+
# to separate the digits, it gets the numbers from the string and checks the
|
3
|
+
# verification digit. So all of these formats are valid: `1.111.111-1`,
|
4
|
+
# `1_111_111_1`, `1.111.111/1`.
|
5
|
+
# rubocop:disable Naming/UncommunicativeMethodParamName
|
1
6
|
module CiUY
|
2
7
|
def self.validation_digit(ci)
|
3
8
|
ci = transform(ci)
|
@@ -11,6 +16,7 @@ module CiUY
|
|
11
16
|
|
12
17
|
def self.validate_ci(ci)
|
13
18
|
ci = transform(ci)
|
19
|
+
return false if ci.length < 6
|
14
20
|
dig = ci[-1]
|
15
21
|
ci = ci[0..-2]
|
16
22
|
get_validation_digit(ci) == dig
|
@@ -34,3 +40,4 @@ module CiUY
|
|
34
40
|
alias get_random_ci random
|
35
41
|
end
|
36
42
|
end
|
43
|
+
# rubocop:enable Naming/UncommunicativeMethodParamName
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci_uy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Briano
|
@@ -9,21 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-04-11 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: minitest
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.11'
|
12
|
+
dependencies: []
|
27
13
|
description: A gem to validate Uruguayan Identity Documents (Cedula de Identidad Uruguaya)
|
28
14
|
email: fernando@picandocodigo.net
|
29
15
|
executables:
|
@@ -37,7 +23,13 @@ homepage: https://github.com/picandocodigo/ci_uy
|
|
37
23
|
licenses:
|
38
24
|
- LGPL-2.1
|
39
25
|
metadata: {}
|
40
|
-
post_install_message:
|
26
|
+
post_install_message: |2+
|
27
|
+
|
28
|
+
Thanks for installing CiUY!
|
29
|
+
|
30
|
+
Warning: Since version 0.1.3, numbers with less than 6 digits are not valid.
|
31
|
+
Atención: Desde la versión 0.1.3 los números con menos de 6 dígitos no son válidos.
|
32
|
+
|
41
33
|
rdoc_options: []
|
42
34
|
require_paths:
|
43
35
|
- lib
|
@@ -53,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
45
|
version: '0'
|
54
46
|
requirements: []
|
55
47
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.7.
|
48
|
+
rubygems_version: 2.7.6
|
57
49
|
signing_key:
|
58
50
|
specification_version: 4
|
59
51
|
summary: CiUY Validate Uruguayan cedula numbers
|