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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ci_uy +8 -10
  3. data/lib/ci_uy.rb +7 -0
  4. metadata +10 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c458e8eef27783014b602657dfa7655f308fd50d45fab67f450a0233b954a906
4
- data.tar.gz: b779c36fac29774ea7c6fe9023b0c2f3bbfc48c21548991d1f0445e8b02f949f
3
+ metadata.gz: 1388476217e551d47b5eb9c0d100790566d9e590646722705c7ec4990b1ee162
4
+ data.tar.gz: 1c329eed7b4e4af2866d9f401b18a24826ba8072517fa26bf45411a145d08136
5
5
  SHA512:
6
- metadata.gz: c6792b16f167f6b769f639ae37f19639e69f0fd241980b9c2afb0ec473ab33b11bb502db0806ec78304990e5ebcbd26bb901e52a54ada73f26d005eeecb4660e
7
- data.tar.gz: 86990f06f636fb7c34989712e6f61a4546404f81bed733524579ccbe5c194dde2ea1f3e2a9e2cbe699fdc94c812468452feafe67f3f9d98bbb3fbd5ec782af5d
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 <<EOS
14
+ puts <<-MANUAL
16
15
 
17
- Usage:
18
- ci_uy [parameter[ci number]]
16
+ Usage:
17
+ ci_uy [parameter[ci number]]
19
18
 
20
- Possible parameters are:
21
- validate [number] - validates given CI number, returns true or false
22
- validation_digit [number] - returns validation digit for given number CI number
23
- random - returns a random valid CI number.
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.2
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: Thanks for installing CiUY!
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.3
48
+ rubygems_version: 2.7.6
57
49
  signing_key:
58
50
  specification_version: 4
59
51
  summary: CiUY Validate Uruguayan cedula numbers