br_documents 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/br_documents/commons/mod14.rb +21 -0
- data/lib/br_documents/ie/ro.rb +2 -2
- data/lib/br_documents/version.rb +1 -1
- data/spec/ie/ro_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d69d78462e3ab61040e25f8540bf7775a80f0f
|
4
|
+
data.tar.gz: da45afd43f7ab8283f2175a6d7202d1bbe34ae5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53f7b3ca1a384b09aa3a4ece17793fc5707e9443015b0916822c808278d1f1c18eb2e0dff24346b24a1b68815b85088fbe9478f38f92330bfeda1f58f1afd5ae
|
7
|
+
data.tar.gz: f7bc5af898cd89ceaa00ac06261fa91559a9187d72bce79fc4121eba7cc501c69710774bac7b6c1eb032e542dde2351905a63ce306e4445784537ae5fbebfd5c
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module BrDocuments
|
2
|
+
module Commons
|
3
|
+
module Mod14
|
4
|
+
|
5
|
+
def generate_digital_check(values, weights)
|
6
|
+
sum = reduce_weights(values, weights)
|
7
|
+
mod = sum % 11
|
8
|
+
mod = (11 - mod)
|
9
|
+
mod < 10 ? mod : (mod - 10)
|
10
|
+
end
|
11
|
+
|
12
|
+
def reduce_weights(values, weights)
|
13
|
+
sum = 0
|
14
|
+
weights.each_index do |i|
|
15
|
+
sum += weights[i] * values[i].to_i
|
16
|
+
end
|
17
|
+
sum
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/br_documents/ie/ro.rb
CHANGED
data/lib/br_documents/version.rb
CHANGED
data/spec/ie/ro_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: br_documents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ASSEINFO - Sistemas de Informação
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/br_documents/cnpj_cpf/document.rb
|
145
145
|
- lib/br_documents/cnpj_validator.rb
|
146
146
|
- lib/br_documents/commons/mod11.rb
|
147
|
+
- lib/br_documents/commons/mod14.rb
|
147
148
|
- lib/br_documents/cpf_validator.rb
|
148
149
|
- lib/br_documents/gtin/gtin.rb
|
149
150
|
- lib/br_documents/gtin_validator.rb
|