active_subset_validator 0.0.1
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/.gitignore +17 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +5 -0
- data/active_subset_validator.gemspec +27 -0
- data/lib/active_subset_validator/railtie.rb +9 -0
- data/lib/active_subset_validator/subset_validator.rb +40 -0
- data/lib/active_subset_validator/version.rb +3 -0
- data/lib/active_subset_validator.rb +32 -0
- data/spec/active_subset_validator/subset_validator_spec.rb +160 -0
- data/spec/active_subset_validator_spec.rb +51 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/active_record.rb +29 -0
- metadata +169 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Paul Sorensen
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# ActiveSubsetValidator
|
2
|
+
[](https://codeclimate.com/github/paulnsorensen/active_subset_validator)
|
3
|
+
[](https://gemnasium.com/paulnsorensen/active_subset_validator)
|
4
|
+
|
5
|
+
Provides subset validation for serialized arrays or sets in Active Record.
|
6
|
+
Checks whether given values for a serialized array or set are a subset of
|
7
|
+
a given array, set or proc against which to validate.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'active_subset_validator'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install active_subset_validator
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
class Foo < ActiveRecord::Base
|
26
|
+
validates :bars, subset: { of: %w(some list of strings) }
|
27
|
+
end
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'active_subset_validator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "active_subset_validator"
|
8
|
+
spec.version = ActiveSubsetValidator::VERSION
|
9
|
+
spec.authors = ["Paul Sorensen"]
|
10
|
+
spec.email = ["paulnsorensen@gmail.com"]
|
11
|
+
spec.description = %q{Provides subset validation for serialized arrays or sets in Active Record}
|
12
|
+
spec.summary = %q{Checks whether given values for a serialized array or set are a subset of a given array, set or proc against which to validate}
|
13
|
+
spec.homepage = "https://github.com/paulnsorensen/active_subset_validator"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "activerecord"
|
25
|
+
spec.add_development_dependency "sqlite3"
|
26
|
+
spec.add_runtime_dependency 'activemodel', '>= 3'
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class SubsetValidator < ActiveModel::EachValidator
|
2
|
+
ERROR_MESSAGE = "An argument must be supplied for the :of option " <<
|
3
|
+
"of the configuration hash and must evaluate to an array or a set"
|
4
|
+
|
5
|
+
def check_validity!
|
6
|
+
if options[:of].respond_to?(:call)
|
7
|
+
return
|
8
|
+
elsif options[:of].is_a?(Array) || options[:of].is_a?(Set)
|
9
|
+
unless ActiveSubsetValidator.is_a_set? options[:of]
|
10
|
+
raise ArgumentError, ERROR_MESSAGE
|
11
|
+
end
|
12
|
+
else
|
13
|
+
raise ArgumentError, ERROR_MESSAGE
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def validate_each(record, attribute, value)
|
18
|
+
message = options[:message] ? options[:message] : "is not a subset of the list"
|
19
|
+
allow_nil = options[:allow_nil] === false ? false : true
|
20
|
+
|
21
|
+
if options[:of].respond_to?(:call)
|
22
|
+
superset = options[:of].call(record)
|
23
|
+
unless ActiveSubsetValidator.is_a_set? superset
|
24
|
+
raise ArgumentError, ERROR_MESSAGE
|
25
|
+
end
|
26
|
+
else
|
27
|
+
superset = options[:of]
|
28
|
+
end
|
29
|
+
|
30
|
+
if value.nil?
|
31
|
+
unless allow_nil
|
32
|
+
record.errors[attribute] << "cannot be nil"
|
33
|
+
end
|
34
|
+
else
|
35
|
+
unless ActiveSubsetValidator.set_difference(value, superset).empty?
|
36
|
+
record.errors[attribute] << message
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
require "active_subset_validator/version"
|
3
|
+
require "active_subset_validator/subset_validator"
|
4
|
+
require "active_subset_validator/railtie" if defined? Rails
|
5
|
+
|
6
|
+
module ActiveSubsetValidator
|
7
|
+
SET_DIFF_ERROR = "Arguments much match types upon evaluation. " <<
|
8
|
+
"Expects Array or Set."
|
9
|
+
|
10
|
+
def self.is_a_set? obj, *args
|
11
|
+
if obj.respond_to?(:call)
|
12
|
+
obj = obj.call *args
|
13
|
+
end
|
14
|
+
if obj.is_a?(Set)
|
15
|
+
return true
|
16
|
+
elsif obj.is_a?(Array)
|
17
|
+
return obj.to_set.to_a == obj
|
18
|
+
else
|
19
|
+
return false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set_difference obj1, obj2
|
24
|
+
if obj1.is_a?(Array) && obj2.is_a?(Array)
|
25
|
+
(obj1.to_set - obj2.to_set).to_a
|
26
|
+
elsif obj1.is_a?(Set) && obj2.is_a?(Set)
|
27
|
+
obj1 - obj2
|
28
|
+
else
|
29
|
+
raise ArgumentError, SET_DIFF_ERROR
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class Comment < ActiveRecord::Base
|
4
|
+
end
|
5
|
+
|
6
|
+
describe SubsetValidator do
|
7
|
+
it "inherits from ActiveModel::EachValidator" do
|
8
|
+
SubsetValidator.superclass.should equal ActiveModel::EachValidator
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#check_validity!" do
|
12
|
+
before(:each) do
|
13
|
+
Comment.send(:serialize, :tags, Array)
|
14
|
+
Comment.reset_callbacks(:validate)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "fails on an invalid array" do
|
18
|
+
expect {
|
19
|
+
Comment.validates :tags, subset: { of: %w(foo bar baz baz) }
|
20
|
+
}.to raise_error ArgumentError
|
21
|
+
end
|
22
|
+
it "fails on an invalid argument" do
|
23
|
+
expect {
|
24
|
+
Comment.validates :tags, subset: { of: Hash.new }
|
25
|
+
}.to raise_error ArgumentError
|
26
|
+
end
|
27
|
+
it "does not fail when passed a lambda" do
|
28
|
+
expect {
|
29
|
+
Comment.validates :tags, subset: { of: lambda { |a| Set.new a } }
|
30
|
+
}.not_to raise_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#validate_each" do
|
35
|
+
before(:each) do
|
36
|
+
Comment.reset_callbacks(:validate)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "raises an error when the attribute is Array and :of type is Set" do
|
40
|
+
Comment.send(:serialize, :tags, Array)
|
41
|
+
Comment.validates :tags, subset: { of: Set.new([1,2,3]) }
|
42
|
+
comment = Comment.new
|
43
|
+
comment.tags = %w(python java)
|
44
|
+
expect { comment.valid? }.to raise_error ArgumentError
|
45
|
+
end
|
46
|
+
|
47
|
+
it "raises an error when the attribute is Set and :of type is Array" do
|
48
|
+
Comment.send(:serialize, :tags, Set)
|
49
|
+
Comment.validates :tags, subset: { of: %w(tee hee) }
|
50
|
+
comment = Comment.new
|
51
|
+
comment.tags = Set.new %w(python java)
|
52
|
+
expect { comment.valid? }.to raise_error ArgumentError
|
53
|
+
end
|
54
|
+
|
55
|
+
it "raises an error when proc evaluates to an incorrect type" do
|
56
|
+
Comment.send(:serialize, :tags, Set)
|
57
|
+
Comment.validates :tags, subset: { of: Proc.new { |r| r.class.to_s } }
|
58
|
+
comment = Comment.new
|
59
|
+
comment.tags = Set.new %w(python java)
|
60
|
+
expect { comment.valid? }.to raise_error ArgumentError
|
61
|
+
end
|
62
|
+
|
63
|
+
it "adds an error for the invalid attribute when :of is a Proc" do
|
64
|
+
Comment.send(:serialize, :tags, Set)
|
65
|
+
Comment.send(:define_method, 'valid_set') do
|
66
|
+
Set.new %w(ruby python scala)
|
67
|
+
end
|
68
|
+
Comment.validates :tags, subset: { of: Proc.new { |r| r.valid_set } }
|
69
|
+
comment = Comment.new
|
70
|
+
comment.tags = Set.new %w(python java)
|
71
|
+
comment.valid?
|
72
|
+
comment.errors[:tags].first.should eq "is not a subset of the list"
|
73
|
+
end
|
74
|
+
|
75
|
+
it "adds an error for the invalid attribute when :of is a Set" do
|
76
|
+
Comment.send(:serialize, :tags, Set)
|
77
|
+
Comment.validates :tags, subset: { of: Set.new([1,2,3,5]) }
|
78
|
+
comment = Comment.new
|
79
|
+
comment.tags = Set.new [2,4]
|
80
|
+
comment.valid?
|
81
|
+
comment.errors[:tags].first.should eq "is not a subset of the list"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "adds an error for the invalid attribute when :of is an Array" do
|
85
|
+
Comment.send(:serialize, :tags, Array)
|
86
|
+
Comment.validates :tags, subset: { of: %w(Atlanta Cleveland Chicago) }
|
87
|
+
comment = Comment.new
|
88
|
+
comment.tags = %w(Chicago Boston)
|
89
|
+
comment.valid?
|
90
|
+
comment.errors[:tags].first.should eq "is not a subset of the list"
|
91
|
+
end
|
92
|
+
|
93
|
+
it "adds a custom error message for an invalid attribute when passed" do
|
94
|
+
Comment.send(:serialize, :tags, Array)
|
95
|
+
Comment.validates :tags, subset: {
|
96
|
+
of: %w(Atlanta Cleveland Chicago),
|
97
|
+
message: "contains an out-of-range city"
|
98
|
+
}
|
99
|
+
comment = Comment.new
|
100
|
+
comment.tags = %w(Chicago Boston)
|
101
|
+
comment.valid?
|
102
|
+
comment.errors[:tags].first.should eq "contains an out-of-range city"
|
103
|
+
end
|
104
|
+
|
105
|
+
it "correctly validates a serialized Set when :of is a Set" do
|
106
|
+
Comment.send(:serialize, :tags, Set)
|
107
|
+
Comment.send(:define_method, 'valid_set') do
|
108
|
+
Set.new %w(ruby python scala)
|
109
|
+
end
|
110
|
+
Comment.validates :tags, subset: { of: Set.new(%w(java scala python)) }
|
111
|
+
comment = Comment.new
|
112
|
+
comment.tags = Set.new %w(python java)
|
113
|
+
comment.valid?.should eq true
|
114
|
+
end
|
115
|
+
|
116
|
+
it "correctly validates a serialized Set when :of is a Proc" do
|
117
|
+
Comment.send(:serialize, :tags, Set)
|
118
|
+
Comment.send(:define_method, 'valid_set') do
|
119
|
+
Set.new %w(ruby python scala)
|
120
|
+
end
|
121
|
+
Comment.validates :tags, subset: { of: Proc.new { |r| r.valid_set } }
|
122
|
+
comment = Comment.new
|
123
|
+
comment.tags = Set.new %w(python ruby)
|
124
|
+
comment.valid?.should eq true
|
125
|
+
end
|
126
|
+
|
127
|
+
it "correctly validates a serialized Array when :of is a Array" do
|
128
|
+
Comment.send(:serialize, :tags, Array)
|
129
|
+
Comment.validates :tags, subset: { of: %w(Atlanta Boston Chicago) }
|
130
|
+
comment = Comment.new
|
131
|
+
comment.tags = %w(Chicago Boston)
|
132
|
+
comment.valid?.should eq true
|
133
|
+
end
|
134
|
+
|
135
|
+
it "correctly validates a serialized Array when :of is a Proc" do
|
136
|
+
Comment.send(:serialize, :tags, Array)
|
137
|
+
Comment.validates :tags, subset: { of: Proc.new { [1,3,9,27,81] } }
|
138
|
+
comment = Comment.new
|
139
|
+
comment.tags = [9,27]
|
140
|
+
comment.valid?.should eq true
|
141
|
+
end
|
142
|
+
|
143
|
+
it "allows nil if :allow_nil is true (default)" do
|
144
|
+
Comment.send(:serialize, :tags, Array)
|
145
|
+
Comment.validates :tags, subset: { of: [1,3,9,27,81] }
|
146
|
+
comment = Comment.new
|
147
|
+
comment.tags = nil
|
148
|
+
comment.valid?.should eq true
|
149
|
+
end
|
150
|
+
|
151
|
+
it "doesn't allow nil if :allow_nil is false" do
|
152
|
+
Comment.send(:serialize, :tags, Array)
|
153
|
+
Comment.validates :tags, subset: { of: [1,3,9,27,81], allow_nil: false }
|
154
|
+
comment = Comment.new
|
155
|
+
comment.tags = nil
|
156
|
+
comment.valid?
|
157
|
+
comment.errors[:tags].first.should eq "cannot be nil"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveSubsetValidator do
|
4
|
+
describe "#is_a_set?" do
|
5
|
+
it "returns true if an array is a set" do
|
6
|
+
ActiveSubsetValidator.is_a_set?((1..20).to_a).should eq(true)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "returns false if an array has duplicate values" do
|
10
|
+
ActiveSubsetValidator.is_a_set?(%w(foo foo bar baz)).should eq(false)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns true if a Set is a set" do
|
14
|
+
ActiveSubsetValidator.is_a_set?(Set.new [1,2,4]).should eq(true)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns true if a proc that is passed returns a proper array" do
|
18
|
+
ActiveSubsetValidator.is_a_set?(Proc.new { %w(foo bar baz) }).should eq(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns false if a proc that is passed returns an improper array" do
|
22
|
+
ActiveSubsetValidator.is_a_set?(Proc.new { %w(foo foo bar baz) }).should eq(false)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns true if a proc that is passed returns a set" do
|
26
|
+
ActiveSubsetValidator.is_a_set?(Proc.new { Set.new [1,2,4] }).should eq(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns true for valid procs with arguments" do
|
30
|
+
ActiveSubsetValidator.is_a_set?(Proc.new { |a| Set.new a }, [1,2,3]).should eq(true)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#set_difference" do
|
35
|
+
it "returns [] if the first array is a subset of the second array" do
|
36
|
+
ActiveSubsetValidator.set_difference(%w(foo bar), %w(foo bar baz)).should eq([])
|
37
|
+
end
|
38
|
+
|
39
|
+
it "returns [] if the first and second arrays have the same values" do
|
40
|
+
ActiveSubsetValidator.set_difference([1.0, 2.4, 3.9], [2.4, 1.0, 3.9]).should eq([])
|
41
|
+
end
|
42
|
+
|
43
|
+
it "returns the set difference when the first array has more values" do
|
44
|
+
ActiveSubsetValidator.set_difference(%w(foo bar baz beans), %w(foo bar baz)).should eq(%w(beans))
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns the set difference when the first array is outside the set of the second" do
|
48
|
+
ActiveSubsetValidator.set_difference(%w(beans), %w(foo bar baz)).should eq(%w(beans))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
3
|
+
|
4
|
+
module ActiveModel::Validations
|
5
|
+
# Extension to enhance `should have` on AR Model instances. Calls
|
6
|
+
# model.valid? in order to prepare the object's errors object.
|
7
|
+
#
|
8
|
+
# You can also use this to specify the content of the error messages.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
#
|
12
|
+
# model.should have(:no).errors_on(:attribute)
|
13
|
+
# model.should have(1).error_on(:attribute)
|
14
|
+
# model.should have(n).errors_on(:attribute)
|
15
|
+
#
|
16
|
+
# model.errors_on(:attribute).should include("can't be blank")
|
17
|
+
def errors_on(attribute)
|
18
|
+
self.valid?
|
19
|
+
[self.errors[attribute]].flatten.compact
|
20
|
+
end
|
21
|
+
alias :error_on :errors_on
|
22
|
+
end
|
23
|
+
|
24
|
+
# test model we'll use in each spec
|
25
|
+
ActiveRecord::Migration.create_table :comments do |t|
|
26
|
+
t.string :text
|
27
|
+
t.text :tags
|
28
|
+
t.timestamps
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_subset_validator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Paul Sorensen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: activerecord
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: sqlite3
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: activemodel
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '3'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3'
|
110
|
+
description: Provides subset validation for serialized arrays or sets in Active Record
|
111
|
+
email:
|
112
|
+
- paulnsorensen@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .rspec
|
119
|
+
- CHANGELOG.md
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- active_subset_validator.gemspec
|
125
|
+
- lib/active_subset_validator.rb
|
126
|
+
- lib/active_subset_validator/railtie.rb
|
127
|
+
- lib/active_subset_validator/subset_validator.rb
|
128
|
+
- lib/active_subset_validator/version.rb
|
129
|
+
- spec/active_subset_validator/subset_validator_spec.rb
|
130
|
+
- spec/active_subset_validator_spec.rb
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/support/active_record.rb
|
133
|
+
homepage: https://github.com/paulnsorensen/active_subset_validator
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
hash: -4092742916326351878
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
hash: -4092742916326351878
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 1.8.25
|
161
|
+
signing_key:
|
162
|
+
specification_version: 3
|
163
|
+
summary: Checks whether given values for a serialized array or set are a subset of
|
164
|
+
a given array, set or proc against which to validate
|
165
|
+
test_files:
|
166
|
+
- spec/active_subset_validator/subset_validator_spec.rb
|
167
|
+
- spec/active_subset_validator_spec.rb
|
168
|
+
- spec/spec_helper.rb
|
169
|
+
- spec/support/active_record.rb
|