localized_each_validator 1.0.1 → 1.0.3

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a597e28a4bac415c19364fceea7c8b8957724412
4
+ data.tar.gz: 32faaee0e6bac011a70b6d0eb7eb14bdcae44391
5
+ SHA512:
6
+ metadata.gz: 8dd43de193eae4c553d378c76c604d074f0881b6ca03476ad2deffdf09f3c62480a4103875725af3f722990a9af339c95222532820abc59c95ec87ad7cbc39d0
7
+ data.tar.gz: 5b6167cca472fed4c28d60124d897731fe846049be4e1095b9511e199140567d801bee3ebfacf51816c73bf675d62395310f156cb1dd978f45618bbe2901c94e
@@ -1,7 +1,7 @@
1
1
  h1. Localized @EachValidator@
2
2
 
3
3
  | *Author* | Tim Morgan |
4
- | *Version* | 1.0.1 (Oct 31, 2010) |
4
+ | *Version* | 1.0.3 (Jul 23, 2013) |
5
5
  | *License* | Released under the MIT license. |
6
6
 
7
7
  h2. About
@@ -1,5 +1,5 @@
1
1
  require 'active_support/core_ext/hash/except'
2
- require 'active_record'
2
+ require 'active_model/validator'
3
3
 
4
4
  # An @EachValidator@ that uses the translation table to build its error
5
5
  # messages. Override the {#valid?} method to describe your validation
@@ -17,8 +17,6 @@ require 'active_record'
17
17
  # @abstract Subclass this validator to perform your specific validations.
18
18
 
19
19
  class LocalizedEachValidator < ActiveModel::EachValidator
20
- extend ActiveSupport::Memoizable
21
-
22
20
  # @private
23
21
  def validate_each(record, attribute, value)
24
22
  return if options[:allow_nil] and value.nil?
@@ -1,60 +1,57 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{localized_each_validator}
8
- s.version = "1.0.1"
7
+ s.name = "localized_each_validator"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tim Morgan"]
12
- s.date = %q{2010-10-31}
13
- s.description = %q{Adds an abstract EachValidator superclass that you can use to create localizable validations.}
14
- s.email = %q{git@timothymorgan.info}
12
+ s.date = "2013-07-24"
13
+ s.description = "Adds an abstract EachValidator superclass that you can use to create localizable validations."
14
+ s.email = "git@timothymorgan.info"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.textile"
17
+ "README.textile"
18
18
  ]
19
19
  s.files = [
20
- ".document",
21
- ".gitignore",
22
- ".rspec",
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE",
26
- "README.textile",
27
- "Rakefile",
28
- "VERSION",
29
- "lib/localized_each_validator.rb",
30
- "localized_each_validator.gemspec",
31
- "spec/localized_each_validator_spec.rb",
32
- "spec/spec_helper.rb"
20
+ "LICENSE",
21
+ "README.textile",
22
+ "lib/localized_each_validator.rb",
23
+ "localized_each_validator.gemspec"
33
24
  ]
34
- s.homepage = %q{http://github.com/riscfuture/localized_each_validator}
35
- s.rdoc_options = ["--charset=UTF-8"]
25
+ s.homepage = "http://github.com/riscfuture/localized_each_validator"
36
26
  s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.3.7}
38
- s.summary = %q{Simple EachValidator with localization support}
39
- s.test_files = [
40
- "spec/localized_each_validator_spec.rb",
41
- "spec/spec_helper.rb"
42
- ]
27
+ s.rubygems_version = "2.0.5"
28
+ s.summary = "Simple EachValidator with localization support"
43
29
 
44
30
  if s.respond_to? :specification_version then
45
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
- s.specification_version = 3
31
+ s.specification_version = 4
47
32
 
48
33
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_runtime_dependency(%q<activerecord>, [">= 3.0"])
34
+ s.add_runtime_dependency(%q<activemodel>, [">= 3.0"])
50
35
  s.add_runtime_dependency(%q<activesupport>, [">= 3.0"])
36
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
37
+ s.add_development_dependency(%q<yard>, [">= 0"])
38
+ s.add_development_dependency(%q<RedCloth>, [">= 0"])
39
+ s.add_development_dependency(%q<rspec>, [">= 0"])
51
40
  else
52
- s.add_dependency(%q<activerecord>, [">= 3.0"])
41
+ s.add_dependency(%q<activemodel>, [">= 3.0"])
53
42
  s.add_dependency(%q<activesupport>, [">= 3.0"])
43
+ s.add_dependency(%q<jeweler>, [">= 0"])
44
+ s.add_dependency(%q<yard>, [">= 0"])
45
+ s.add_dependency(%q<RedCloth>, [">= 0"])
46
+ s.add_dependency(%q<rspec>, [">= 0"])
54
47
  end
55
48
  else
56
- s.add_dependency(%q<activerecord>, [">= 3.0"])
49
+ s.add_dependency(%q<activemodel>, [">= 3.0"])
57
50
  s.add_dependency(%q<activesupport>, [">= 3.0"])
51
+ s.add_dependency(%q<jeweler>, [">= 0"])
52
+ s.add_dependency(%q<yard>, [">= 0"])
53
+ s.add_dependency(%q<RedCloth>, [">= 0"])
54
+ s.add_dependency(%q<rspec>, [">= 0"])
58
55
  end
59
56
  end
60
57
 
metadata CHANGED
@@ -1,106 +1,133 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: localized_each_validator
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 1
9
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Tim Morgan
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2010-10-31 00:00:00 -07:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: activerecord
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 3
29
- - 0
30
- version: "3.0"
11
+ date: 2013-07-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
31
20
  type: :runtime
32
21
  prerelease: false
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
35
28
  name: activesupport
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 3
43
- - 0
44
- version: "3.0"
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
45
34
  type: :runtime
46
35
  prerelease: false
47
- version_requirements: *id002
48
- description: Adds an abstract EachValidator superclass that you can use to create localizable validations.
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jeweler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: RedCloth
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Adds an abstract EachValidator superclass that you can use to create
98
+ localizable validations.
49
99
  email: git@timothymorgan.info
50
100
  executables: []
51
-
52
101
  extensions: []
53
-
54
- extra_rdoc_files:
102
+ extra_rdoc_files:
55
103
  - LICENSE
56
104
  - README.textile
57
- files:
58
- - .document
59
- - .gitignore
60
- - .rspec
61
- - Gemfile
62
- - Gemfile.lock
105
+ files:
63
106
  - LICENSE
64
107
  - README.textile
65
- - Rakefile
66
- - VERSION
67
108
  - lib/localized_each_validator.rb
68
109
  - localized_each_validator.gemspec
69
- - spec/localized_each_validator_spec.rb
70
- - spec/spec_helper.rb
71
- has_rdoc: true
72
110
  homepage: http://github.com/riscfuture/localized_each_validator
73
111
  licenses: []
74
-
112
+ metadata: {}
75
113
  post_install_message:
76
- rdoc_options:
77
- - --charset=UTF-8
78
- require_paths:
114
+ rdoc_options: []
115
+ require_paths:
79
116
  - lib
80
- required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 2150682735534993403
86
- segments:
87
- - 0
88
- version: "0"
89
- required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- segments:
95
- - 0
96
- version: "0"
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
97
127
  requirements: []
98
-
99
128
  rubyforge_project:
100
- rubygems_version: 1.3.7
129
+ rubygems_version: 2.0.5
101
130
  signing_key:
102
- specification_version: 3
131
+ specification_version: 4
103
132
  summary: Simple EachValidator with localization support
104
- test_files:
105
- - spec/localized_each_validator_spec.rb
106
- - spec/spec_helper.rb
133
+ test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,25 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
- .bundle
21
- .rvmrc
22
-
23
- ## PROJECT::DOCUMENTATION
24
- .yardoc
25
- doc
data/.rspec DELETED
@@ -1 +0,0 @@
1
- -cfs
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source :rubygems
2
-
3
- # DEPENDENCIES
4
- gem 'activerecord', require: 'active_record'
5
- gem 'activesupport', require: 'active_record'
6
-
7
- # DEVELOPMENT
8
- gem 'jeweler'
9
- gem 'yard'
10
- gem 'RedCloth', require: 'redcloth'
11
-
12
- # TEST
13
- gem 'rspec'
@@ -1,51 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- RedCloth (4.2.3)
5
- activemodel (3.0.1)
6
- activesupport (= 3.0.1)
7
- builder (~> 2.1.2)
8
- i18n (~> 0.4.1)
9
- activerecord (3.0.1)
10
- activemodel (= 3.0.1)
11
- activesupport (= 3.0.1)
12
- arel (~> 1.0.0)
13
- tzinfo (~> 0.3.23)
14
- activesupport (3.0.1)
15
- arel (1.0.1)
16
- activesupport (~> 3.0.0)
17
- builder (2.1.2)
18
- diff-lcs (1.1.2)
19
- gemcutter (0.6.1)
20
- git (1.2.5)
21
- i18n (0.4.2)
22
- jeweler (1.4.0)
23
- gemcutter (>= 0.1.0)
24
- git (>= 1.2.5)
25
- rubyforge (>= 2.0.0)
26
- json_pure (1.4.6)
27
- rspec (2.0.1)
28
- rspec-core (~> 2.0.1)
29
- rspec-expectations (~> 2.0.1)
30
- rspec-mocks (~> 2.0.1)
31
- rspec-core (2.0.1)
32
- rspec-expectations (2.0.1)
33
- diff-lcs (>= 1.1.2)
34
- rspec-mocks (2.0.1)
35
- rspec-core (~> 2.0.1)
36
- rspec-expectations (~> 2.0.1)
37
- rubyforge (2.0.4)
38
- json_pure (>= 1.1.7)
39
- tzinfo (0.3.23)
40
- yard (0.6.1)
41
-
42
- PLATFORMS
43
- ruby
44
-
45
- DEPENDENCIES
46
- RedCloth
47
- activerecord
48
- activesupport
49
- jeweler
50
- rspec
51
- yard
data/Rakefile DELETED
@@ -1,36 +0,0 @@
1
- require 'rake'
2
- begin
3
- require 'bundler'
4
- rescue LoadError
5
- puts "Bundler is not installed; install with `gem install bundler`."
6
- exit 1
7
- end
8
-
9
- Bundler.require :default
10
-
11
- Jeweler::Tasks.new do |gem|
12
- gem.name = "localized_each_validator"
13
- gem.summary = %Q{Simple EachValidator with localization support}
14
- gem.description = %Q{Adds an abstract EachValidator superclass that you can use to create localizable validations.}
15
- gem.email = "git@timothymorgan.info"
16
- gem.homepage = "http://github.com/riscfuture/localized_each_validator"
17
- gem.authors = [ "Tim Morgan" ]
18
- gem.add_dependency 'activerecord', '>= 3.0'
19
- gem.add_dependency 'activesupport', '>= 3.0'
20
- end
21
- Jeweler::GemcutterTasks.new
22
-
23
- require 'rspec/core/rake_task'
24
- RSpec::Core::RakeTask.new
25
-
26
- YARD::Rake::YardocTask.new('doc') do |doc|
27
- doc.options << "-m" << "textile"
28
- doc.options << "--protected"
29
- doc.options << "-r" << "README.textile"
30
- doc.options << "-o" << "doc"
31
- doc.options << "--title" << "Localized EachValidator Documentation".inspect
32
-
33
- doc.files = [ 'lib/**/*', 'README.textile' ]
34
- end
35
-
36
- task(default: :spec)
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.1
@@ -1,54 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module SpecSupport
4
- class TestLocalizedEachValidator < LocalizedEachValidator
5
- def valid?(_,_, v) v == 'foo' end
6
- end
7
- class FakeModel
8
- extend ActiveModel::Translation
9
- def errors() @errors ||= ActiveModel::Errors.new(self) end
10
- def self.lookup_ancestors() [ self ] end
11
- def read_attribute_for_validation(_) "mock" end
12
- end
13
- end
14
-
15
- describe LocalizedEachValidator do
16
- before :each do
17
- @model = SpecSupport::FakeModel.new
18
- end
19
-
20
- describe ".error_key_prefix" do
21
- it "should be the downcased name of the validator by default" do
22
- SpecSupport::TestLocalizedEachValidator.error_key.should eql(:test_localized_each)
23
- end
24
-
25
- it "should be able to be set" do
26
- SpecSupport::TestLocalizedEachValidator.error_key(:foo)
27
- SpecSupport::TestLocalizedEachValidator.error_key.should eql(:foo)
28
- SpecSupport::TestLocalizedEachValidator.instance_variable_set :@error_key, nil
29
- end
30
- end
31
-
32
- describe ".validate_each" do
33
- it "should do nothing if given nil and :allow_nil is set" do
34
- SpecSupport::TestLocalizedEachValidator.new(attributes: :field, allow_nil: true).validate_each(@model, :field, nil)
35
- @model.errors.should be_empty
36
- end
37
-
38
- it "should do nothing if given a blank value and :allow_blank is set" do
39
- SpecSupport::TestLocalizedEachValidator.new(attributes: :field, allow_blank: true).validate_each(@model, :field, "")
40
- @model.errors.should be_empty
41
- end
42
-
43
- it "should validate according to the #valid? method" do
44
- SpecSupport::TestLocalizedEachValidator.new(attributes: :field).validate_each(@model, :field, "foo")
45
- @model.errors.should be_empty
46
- end
47
-
48
- it "should add an error if the validation fails" do
49
- SpecSupport::TestLocalizedEachValidator.new(attributes: :field).validate_each(@model, :field, "bar")
50
- @model.errors[:field].should_not be_empty
51
- @model.errors[:field].first.should include('test_localized_each')
52
- end
53
- end
54
- end
@@ -1,10 +0,0 @@
1
- Bundler.require :default, :test
2
-
3
- $LOAD_PATH.unshift(File.dirname(__FILE__))
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
-
6
- require 'localized_each_validator'
7
-
8
- RSpec.configure do |config|
9
-
10
- end