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 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.0') do |p|
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"
@@ -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
@@ -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.0"
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 = ["Manifest", "README.rdoc", "Rakefile", "lib/sa_vat_validation.rb", "sa_vat_validation.gemspec"]
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
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
@@ -1,4 +0,0 @@
1
- Manifest
2
- README.rdoc
3
- Rakefile
4
- lib/sa_vat_validation.rb