enumerated_field 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.octopolo.yml +4 -0
- data/.soyuz.yml +14 -0
- data/.travis.yml +3 -4
- data/CHANGELOG.markdown +2 -0
- data/MIT-LICENSE +20 -0
- data/enumerated_field.gemspec +7 -3
- data/lib/enumerated_field.rb +3 -3
- data/lib/enumerated_field/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +58 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bdda97b31946f54d9ffb6260b6fc29295a3e70e2
|
4
|
+
data.tar.gz: 233ced4a324208d853fd0d90aad4344f6bba7f82
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff0741567bd0c1269179cf96fe9d479ceefd1ad47b57c9dbcde771e8207fdd2f7027ee21d387bc995b70d01ddbc0f882c85b360254881bc0d2cd4d6d55d08338
|
7
|
+
data.tar.gz: 20b0aee3ddcc2e59248c3ed04624bd0abed98319411e71a05bf3bd74205cb9466020e0e7c8124e76f8c9e15ae8ed9d4b2680dbb03e67dcce8d2d2484cab504dc
|
data/.octopolo.yml
ADDED
data/.soyuz.yml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
defaults:
|
2
|
+
deploy_cmds:
|
3
|
+
- gem build enumerated_field.gemspec
|
4
|
+
- gem push *.gem
|
5
|
+
before_deploy_cmds:
|
6
|
+
- /usr/local/bin/op tag-release
|
7
|
+
- sed -i '' -e "s/\".*/\"$(git tag | tail -1 | sed s/v//)\"/" lib/enumerated_field/version.rb
|
8
|
+
- git add lib/enumerated_field/version.rb
|
9
|
+
- git commit -m "Version Bump" && git push
|
10
|
+
after_deploy_cmds:
|
11
|
+
- rm *.gem
|
12
|
+
environments:
|
13
|
+
-
|
14
|
+
rubygems: {}
|
data/.travis.yml
CHANGED
data/CHANGELOG.markdown
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Sport Ngin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/enumerated_field.gemspec
CHANGED
@@ -14,10 +14,13 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.platform = Gem::Platform::RUBY
|
15
15
|
s.authors = AUTHORS.keys
|
16
16
|
s.email = AUTHORS.values
|
17
|
+
s.license = "MIT"
|
17
18
|
s.homepage = "https://github.com/sportngin/enumerated_field"
|
18
19
|
s.summary = %q{EnumeratedField is a library that provides some nice methods when a string column is used like an enumeration.}
|
19
20
|
s.description = %q{EnumeratedField is a library that provides some nice methods when a string column is used like an enumeration, meaning there is a list of allowable values for the string column.}
|
20
21
|
|
22
|
+
s.required_ruby_version = '>= 1.9.3'
|
23
|
+
|
21
24
|
s.rubyforge_project = "enumerated_field"
|
22
25
|
|
23
26
|
s.files = `git ls-files`.split("\n")
|
@@ -25,13 +28,14 @@ Gem::Specification.new do |s|
|
|
25
28
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
29
|
s.require_paths = ["lib"]
|
27
30
|
|
28
|
-
s.add_dependency 'activemodel', ['> 3.0.0', '<
|
29
|
-
s.add_dependency 'activesupport', ['> 3.0.0', '<
|
31
|
+
s.add_dependency 'activemodel', ['> 3.0.0', '< 5.0.0']
|
32
|
+
s.add_dependency 'activesupport', ['> 3.0.0', '< 5.0.0']
|
33
|
+
s.add_development_dependency 'test-unit'
|
30
34
|
s.add_development_dependency 'minitest', "~> 4.0"
|
31
35
|
s.add_development_dependency 'rake'
|
32
36
|
s.add_development_dependency 'bundler'
|
33
37
|
s.add_development_dependency 'turn'
|
34
38
|
s.add_development_dependency 'shoulda', '~> 2'
|
35
|
-
s.add_development_dependency 'activerecord', '~>
|
39
|
+
s.add_development_dependency 'activerecord', '~> 4.0.0'
|
36
40
|
s.add_development_dependency 'sqlite3'
|
37
41
|
end
|
data/lib/enumerated_field.rb
CHANGED
@@ -81,7 +81,7 @@ module EnumeratedField
|
|
81
81
|
end
|
82
82
|
|
83
83
|
# defines question methods for each possible value of the field
|
84
|
-
# ex. object.league_nfl? which returns true if the objects league
|
84
|
+
# ex. object.league_nfl? which returns true if the objects league
|
85
85
|
# field is currently set to nfl otherwise false
|
86
86
|
values_hash.keys.each do |key|
|
87
87
|
define_method("#{field_name}_#{key}?") { send(field_name).to_s == key.to_s }
|
@@ -89,8 +89,8 @@ module EnumeratedField
|
|
89
89
|
|
90
90
|
if defined? ActiveRecord::Base and ancestors.include? ActiveRecord::Base
|
91
91
|
values_hash.keys.each do |key|
|
92
|
-
scope "#{field_name}_#{key}", where(field_name => key)
|
93
|
-
scope "#{field_name}_not_#{key}", where("#{quoted_table_name}.#{connection.quote_column_name(field_name)} != ?", key)
|
92
|
+
scope "#{field_name}_#{key}", ->() { where(field_name => key) }
|
93
|
+
scope "#{field_name}_not_#{key}", ->() { where("#{quoted_table_name}.#{connection.quote_column_name(field_name)} != ?", key) }
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumerated_field
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Luke Ludwig
|
@@ -11,162 +10,158 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: activemodel
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - ">"
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: 3.0.0
|
24
|
-
- - <
|
22
|
+
- - "<"
|
25
23
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
24
|
+
version: 5.0.0
|
27
25
|
type: :runtime
|
28
26
|
prerelease: false
|
29
27
|
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
28
|
requirements:
|
32
|
-
- -
|
29
|
+
- - ">"
|
33
30
|
- !ruby/object:Gem::Version
|
34
31
|
version: 3.0.0
|
35
|
-
- - <
|
32
|
+
- - "<"
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
34
|
+
version: 5.0.0
|
38
35
|
- !ruby/object:Gem::Dependency
|
39
36
|
name: activesupport
|
40
37
|
requirement: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- -
|
39
|
+
- - ">"
|
44
40
|
- !ruby/object:Gem::Version
|
45
41
|
version: 3.0.0
|
46
|
-
- - <
|
42
|
+
- - "<"
|
47
43
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
44
|
+
version: 5.0.0
|
49
45
|
type: :runtime
|
50
46
|
prerelease: false
|
51
47
|
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
48
|
requirements:
|
54
|
-
- -
|
49
|
+
- - ">"
|
55
50
|
- !ruby/object:Gem::Version
|
56
51
|
version: 3.0.0
|
57
|
-
- - <
|
52
|
+
- - "<"
|
58
53
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
54
|
+
version: 5.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
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'
|
60
69
|
- !ruby/object:Gem::Dependency
|
61
70
|
name: minitest
|
62
71
|
requirement: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
72
|
requirements:
|
65
|
-
- - ~>
|
73
|
+
- - "~>"
|
66
74
|
- !ruby/object:Gem::Version
|
67
75
|
version: '4.0'
|
68
76
|
type: :development
|
69
77
|
prerelease: false
|
70
78
|
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
79
|
requirements:
|
73
|
-
- - ~>
|
80
|
+
- - "~>"
|
74
81
|
- !ruby/object:Gem::Version
|
75
82
|
version: '4.0'
|
76
83
|
- !ruby/object:Gem::Dependency
|
77
84
|
name: rake
|
78
85
|
requirement: !ruby/object:Gem::Requirement
|
79
|
-
none: false
|
80
86
|
requirements:
|
81
|
-
- -
|
87
|
+
- - ">="
|
82
88
|
- !ruby/object:Gem::Version
|
83
89
|
version: '0'
|
84
90
|
type: :development
|
85
91
|
prerelease: false
|
86
92
|
version_requirements: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
93
|
requirements:
|
89
|
-
- -
|
94
|
+
- - ">="
|
90
95
|
- !ruby/object:Gem::Version
|
91
96
|
version: '0'
|
92
97
|
- !ruby/object:Gem::Dependency
|
93
98
|
name: bundler
|
94
99
|
requirement: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
100
|
requirements:
|
97
|
-
- -
|
101
|
+
- - ">="
|
98
102
|
- !ruby/object:Gem::Version
|
99
103
|
version: '0'
|
100
104
|
type: :development
|
101
105
|
prerelease: false
|
102
106
|
version_requirements: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
107
|
requirements:
|
105
|
-
- -
|
108
|
+
- - ">="
|
106
109
|
- !ruby/object:Gem::Version
|
107
110
|
version: '0'
|
108
111
|
- !ruby/object:Gem::Dependency
|
109
112
|
name: turn
|
110
113
|
requirement: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
114
|
requirements:
|
113
|
-
- -
|
115
|
+
- - ">="
|
114
116
|
- !ruby/object:Gem::Version
|
115
117
|
version: '0'
|
116
118
|
type: :development
|
117
119
|
prerelease: false
|
118
120
|
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
121
|
requirements:
|
121
|
-
- -
|
122
|
+
- - ">="
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
- !ruby/object:Gem::Dependency
|
125
126
|
name: shoulda
|
126
127
|
requirement: !ruby/object:Gem::Requirement
|
127
|
-
none: false
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
135
|
requirements:
|
137
|
-
- - ~>
|
136
|
+
- - "~>"
|
138
137
|
- !ruby/object:Gem::Version
|
139
138
|
version: '2'
|
140
139
|
- !ruby/object:Gem::Dependency
|
141
140
|
name: activerecord
|
142
141
|
requirement: !ruby/object:Gem::Requirement
|
143
|
-
none: false
|
144
142
|
requirements:
|
145
|
-
- - ~>
|
143
|
+
- - "~>"
|
146
144
|
- !ruby/object:Gem::Version
|
147
|
-
version:
|
145
|
+
version: 4.0.0
|
148
146
|
type: :development
|
149
147
|
prerelease: false
|
150
148
|
version_requirements: !ruby/object:Gem::Requirement
|
151
|
-
none: false
|
152
149
|
requirements:
|
153
|
-
- - ~>
|
150
|
+
- - "~>"
|
154
151
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
152
|
+
version: 4.0.0
|
156
153
|
- !ruby/object:Gem::Dependency
|
157
154
|
name: sqlite3
|
158
155
|
requirement: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
156
|
requirements:
|
161
|
-
- -
|
157
|
+
- - ">="
|
162
158
|
- !ruby/object:Gem::Version
|
163
159
|
version: '0'
|
164
160
|
type: :development
|
165
161
|
prerelease: false
|
166
162
|
version_requirements: !ruby/object:Gem::Requirement
|
167
|
-
none: false
|
168
163
|
requirements:
|
169
|
-
- -
|
164
|
+
- - ">="
|
170
165
|
- !ruby/object:Gem::Version
|
171
166
|
version: '0'
|
172
167
|
description: EnumeratedField is a library that provides some nice methods when a string
|
@@ -180,10 +175,14 @@ executables: []
|
|
180
175
|
extensions: []
|
181
176
|
extra_rdoc_files: []
|
182
177
|
files:
|
183
|
-
- .gitignore
|
184
|
-
- .
|
178
|
+
- ".gitignore"
|
179
|
+
- ".octopolo.yml"
|
180
|
+
- ".soyuz.yml"
|
181
|
+
- ".travis.yml"
|
185
182
|
- CHANGELOG
|
183
|
+
- CHANGELOG.markdown
|
186
184
|
- Gemfile
|
185
|
+
- MIT-LICENSE
|
187
186
|
- README.md
|
188
187
|
- Rakefile
|
189
188
|
- enumerated_field.gemspec
|
@@ -193,34 +192,28 @@ files:
|
|
193
192
|
- test/fixtures/apples.yml
|
194
193
|
- test/test_helper.rb
|
195
194
|
homepage: https://github.com/sportngin/enumerated_field
|
196
|
-
licenses:
|
195
|
+
licenses:
|
196
|
+
- MIT
|
197
|
+
metadata: {}
|
197
198
|
post_install_message:
|
198
199
|
rdoc_options: []
|
199
200
|
require_paths:
|
200
201
|
- lib
|
201
202
|
required_ruby_version: !ruby/object:Gem::Requirement
|
202
|
-
none: false
|
203
203
|
requirements:
|
204
|
-
- -
|
204
|
+
- - ">="
|
205
205
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
207
|
-
segments:
|
208
|
-
- 0
|
209
|
-
hash: 2867089122134608507
|
206
|
+
version: 1.9.3
|
210
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
-
none: false
|
212
208
|
requirements:
|
213
|
-
- -
|
209
|
+
- - ">="
|
214
210
|
- !ruby/object:Gem::Version
|
215
211
|
version: '0'
|
216
|
-
segments:
|
217
|
-
- 0
|
218
|
-
hash: 2867089122134608507
|
219
212
|
requirements: []
|
220
213
|
rubyforge_project: enumerated_field
|
221
|
-
rubygems_version:
|
214
|
+
rubygems_version: 2.2.2
|
222
215
|
signing_key:
|
223
|
-
specification_version:
|
216
|
+
specification_version: 4
|
224
217
|
summary: EnumeratedField is a library that provides some nice methods when a string
|
225
218
|
column is used like an enumeration.
|
226
219
|
test_files:
|