sa_vat_validation 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/sa_vat_validation.rb +7 -0
- data/sa_vat_validation.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +4 -5
- metadata.gz.sig +0 -0
- data/Manifest +0 -4
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('sa_vat_validation', '0.1.
|
5
|
+
Echoe.new('sa_vat_validation', '0.1.1') do |p|
|
6
6
|
p.description = "Validate South African VAT numbers easily"
|
7
7
|
p.url = "http://github.com/mpowered/sa_vat_validation"
|
8
8
|
p.author = "Gary Greyling"
|
data/lib/sa_vat_validation.rb
CHANGED
@@ -8,9 +8,16 @@ class Fixnum
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
class String
|
12
|
+
def is_numeric?
|
13
|
+
Float self rescue false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
11
17
|
class SaVatValidation
|
12
18
|
def self.valid?(vat_number)
|
13
19
|
digits = vat_number.to_s.split(//).map(&:to_i)
|
20
|
+
return false unless digits.size == 10 && vat_number.to_s.is_numeric?
|
14
21
|
check_digit = digits.pop
|
15
22
|
|
16
23
|
sum = 0
|
data/sa_vat_validation.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{sa_vat_validation}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Gary Greyling"]
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = %q{Validate South African VAT numbers easily}
|
12
12
|
s.email = %q{greyling.gary@gmail.co.za}
|
13
13
|
s.extra_rdoc_files = ["README.rdoc", "lib/sa_vat_validation.rb"]
|
14
|
-
s.files = ["
|
14
|
+
s.files = ["README.rdoc", "lib/sa_vat_validation.rb", "sa_vat_validation.gemspec", "Rakefile"]
|
15
15
|
s.homepage = %q{http://github.com/mpowered/sa_vat_validation}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sa_vat_validation", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sa_vat_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gary Greyling
|
@@ -63,11 +63,10 @@ extra_rdoc_files:
|
|
63
63
|
- README.rdoc
|
64
64
|
- lib/sa_vat_validation.rb
|
65
65
|
files:
|
66
|
-
- Manifest
|
67
66
|
- README.rdoc
|
68
|
-
- Rakefile
|
69
67
|
- lib/sa_vat_validation.rb
|
70
68
|
- sa_vat_validation.gemspec
|
69
|
+
- Rakefile
|
71
70
|
has_rdoc: true
|
72
71
|
homepage: http://github.com/mpowered/sa_vat_validation
|
73
72
|
licenses: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/Manifest
DELETED