validator_ie 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +1 -7
- data/lib/validator_ie/core/state_mg.rb +4 -3
- data/lib/validator_ie/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05f2dccc7b5a42e2ea0314b763e3888d63cf5aa1
|
4
|
+
data.tar.gz: 781fd0ee6716b7d16d1a0294f333d8bcb0df722e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1905921ca757eea130fcf6c3c5f0d0a04a222a5d43fbfdb77c665f5628c272b4979413a05c2f6824b1ec36a1d4cd41995248d71e96f81976d4eb4df3aaf55541
|
7
|
+
data.tar.gz: c2680092446fcfce26b47691cbaa3abcb07c6e0db48f459b2f43d1a441550fccc066786db6448c8d0b19bb6094a84531d6dde605ac33f24aa604e7011476c815
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,15 +22,9 @@ Or install it yourself as:
|
|
22
22
|
```ruby
|
23
23
|
result = ValidatorIE::valid?('XXXXXXXXXXXX','AC') # Only numbers
|
24
24
|
unless result
|
25
|
-
puts
|
25
|
+
puts ValidatorIE::errors.full_messages
|
26
26
|
end
|
27
27
|
```
|
28
|
-
## Development
|
29
|
-
|
30
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
-
|
32
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
-
|
34
28
|
## Contributing
|
35
29
|
|
36
30
|
Bug reports and pull requests are welcome on GitHub at https://github.com/rmomogi/validator_ie. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -20,10 +20,10 @@ module ValidatorIE
|
|
20
20
|
self.number = number[0..2].concat("0").concat(number[3..12])
|
21
21
|
matrix = number[0..number.size - 3].split(//).map.with_index {|m, k| k.next.odd? ? 1 : 2}
|
22
22
|
result1 = number_should_modX(11, 11, nil, matrix, true)
|
23
|
-
|
23
|
+
|
24
24
|
self.number = number[0..2].concat(number[4..13])
|
25
25
|
result2 = number_should_modX(11, 11, 11, nil)
|
26
|
-
|
26
|
+
|
27
27
|
return if result1 && result2
|
28
28
|
errors.add(:number, 'não é válido para inscrição estadual.')
|
29
29
|
|
@@ -37,10 +37,11 @@ module ValidatorIE
|
|
37
37
|
return false if at > matrix.size - 1
|
38
38
|
sum = numberX[0..at].map.with_index { |v, k| v * matrix[k]}.join('').split(//).map(&:to_i).reduce(&:+)
|
39
39
|
digit = (sum - (sum.to_s.split(//).last.to_i - 10)) - sum
|
40
|
+
digit = (digit == 10 ? 0 : digit)
|
40
41
|
else
|
41
42
|
sum = ModFunctions.sumX(numberX, at, final, true, matrix)
|
42
43
|
divmod = sum.divmod(mod).last
|
43
|
-
digit = divmod < 2 ? 0 : mod - divmod
|
44
|
+
digit = divmod < 2 ? 0 : mod - divmod
|
44
45
|
end
|
45
46
|
numberX[at + 1].eql?(digit)
|
46
47
|
end
|
data/lib/validator_ie/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validator_ie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Moraes de Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,9 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.6.12
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Gem para validação de inscrição estadual
|
126
126
|
test_files: []
|
127
|
-
has_rdoc:
|