brcpfcnpj 3.0.5 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -29,7 +29,7 @@ end
29
29
  #Generate the RDoc documentation
30
30
  Rake::RDocTask.new { |rdoc|
31
31
  rdoc.rdoc_dir = "doc"
32
- rdoc.title = "Brazilian Rails -- Data"
32
+ rdoc.title = "Brazilian Rails -- CPF/CNPJ"
33
33
  rdoc.options << "--line-numbers" << "--inline-source" << "-A cattr_accessor=object"
34
34
  rdoc.options << "--charset" << "utf-8"
35
35
  rdoc.template = "#{ENV["template"]}.rb" if ENV["template"]
@@ -54,7 +54,7 @@ spec = Gem::Specification.new do |s|
54
54
  s.add_dependency("activesupport", ">= 3.0.0")
55
55
 
56
56
  s.add_development_dependency "rake"
57
- s.add_development_dependency "rspec", ">= 2.0.0"
57
+ s.add_development_dependency "rspec", ">= 2.4.0"
58
58
 
59
59
  s.has_rdoc = true
60
60
  s.requirements << "none"
@@ -62,7 +62,7 @@ spec = Gem::Specification.new do |s|
62
62
 
63
63
  s.files = [ "Rakefile", "README", "CHANGELOG", "MIT-LICENSE" ]
64
64
  s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
65
- s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
65
+ s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
66
66
  end
67
67
 
68
68
  Rake::GemPackageTask.new(spec) do |p|
@@ -2,7 +2,7 @@
2
2
  $:.unshift(File.dirname(__FILE__)) unless
3
3
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
4
4
 
5
- %w(cpf_cnpj cnpj cpf cpf_cnpj_activerecord).each {|req| require File.dirname(__FILE__) + "/brcpfcnpj/#{req}"}
5
+ %w(cpf_cnpj cnpj cpf cpf_cnpj_activerecord cnpj_validator cpf_validator).each {|req| require File.dirname(__FILE__) + "/brcpfcnpj/#{req}"}
6
6
 
7
7
  %w(rubygems active_record active_support).each {|req| require req }
8
8
 
@@ -0,0 +1,6 @@
1
+ class CnpjValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ return if value.nil?
4
+ record.errors[attribute] << "nao e um CNPJ valido" unless Cnpj.new(value).valido?
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class CpfValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ return if value.nil?
4
+ record.errors[attribute] << "nao e um CPF valido" unless Cpf.new(value).valido?
5
+ end
6
+ end
@@ -2,7 +2,7 @@ module BrCpfCnpj
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{TINY}"
8
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 0
8
- - 5
9
- version: 3.0.5
8
+ - 6
9
+ version: 3.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Marcos Tapaj\xC3\xB3s"
@@ -75,9 +75,9 @@ dependencies:
75
75
  - !ruby/object:Gem::Version
76
76
  segments:
77
77
  - 2
78
+ - 4
78
79
  - 0
79
- - 0
80
- version: 2.0.0
80
+ version: 2.4.0
81
81
  type: :development
82
82
  prerelease: false
83
83
  version_requirements: *id004
@@ -102,9 +102,11 @@ files:
102
102
  - CHANGELOG
103
103
  - MIT-LICENSE
104
104
  - lib/brcpfcnpj/cnpj.rb
105
+ - lib/brcpfcnpj/cnpj_validator.rb
105
106
  - lib/brcpfcnpj/cpf.rb
106
107
  - lib/brcpfcnpj/cpf_cnpj.rb
107
108
  - lib/brcpfcnpj/cpf_cnpj_activerecord.rb
109
+ - lib/brcpfcnpj/cpf_validator.rb
108
110
  - lib/brcpfcnpj/version.rb
109
111
  - lib/brcpfcnpj.rb
110
112
  has_rdoc: true
@@ -121,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
123
  requirements:
122
124
  - - ">="
123
125
  - !ruby/object:Gem::Version
124
- hash: 3608075777574979284
126
+ hash: 3643706487061768745
125
127
  segments:
126
128
  - 0
127
129
  version: "0"
@@ -130,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
132
  requirements:
131
133
  - - ">="
132
134
  - !ruby/object:Gem::Version
133
- hash: 3608075777574979284
135
+ hash: 3643706487061768745
134
136
  segments:
135
137
  - 0
136
138
  version: "0"