nilify_blanks 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Appraisals +8 -12
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +64 -59
- data/README.rdoc +16 -20
- data/Rakefile +26 -24
- data/lib/nilify_blanks.rb +25 -44
- data/lib/nilify_blanks/matchers.rb +6 -6
- data/lib/nilify_blanks/railtie.rb +2 -2
- data/lib/nilify_blanks/version.rb +1 -1
- data/spec/db/test.sqlite3 +0 -0
- data/spec/examples.txt +30 -0
- data/spec/nilify_blanks_spec.rb +94 -36
- data/spec/spec_helper.rb +25 -0
- metadata +18 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 117e4a499e7f6e4ca67ca960c463175898f34f06c017549b0d4838ab5d6c2be9
|
4
|
+
data.tar.gz: 3d0dfb25b9c1868a3f14ebb2a04e3ba53d0242fe33c3621fc5233d51e264611b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a0e775623407760b8db4d7d1fbedaad402621e0b57cef64ed3f5a6479948170128493e9c47e9217d1a8d72a1c96eb0a37b4cdbe81a4c3b10b3ce0c09ff8add
|
7
|
+
data.tar.gz: 51f6507d4af29105bc808a2e7a91275538bb26334acabdcaf7bd0682034e4e754d1211cfc51257d8eaca9e2bbbfcaf7cb4617ec58904974f5e61b17f05246884
|
data/Appraisals
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
appraise "3.0" do
|
2
|
-
gem "rails", "~> 3.0.9"
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise "3.1" do
|
6
|
-
gem "rails", "~> 3.1.6"
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise "3.2" do
|
10
|
-
gem "rails", "~> 3.2.6"
|
11
|
-
end
|
12
|
-
|
13
1
|
appraise "4.0" do
|
14
2
|
gem "rails", "~> 4.0.12"
|
15
3
|
end
|
@@ -21,3 +9,11 @@ end
|
|
21
9
|
appraise "4.2" do
|
22
10
|
gem "rails", "~> 4.2.0"
|
23
11
|
end
|
12
|
+
|
13
|
+
appraise "5.2" do
|
14
|
+
gem "rails", "~> 5.2.0"
|
15
|
+
end
|
16
|
+
|
17
|
+
appraise "6.0" do
|
18
|
+
gem "rails", "~> 6.0.2"
|
19
|
+
end
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== [2020-04-18] 1.4.0
|
2
|
+
|
3
|
+
* Internally restructure NilifyBlanks, use modern tooling like ActiveSupport::Concern
|
4
|
+
* Drop support for Rails 3, expand Appraisals to include Rails 6
|
5
|
+
* Change default before callback to :validation (from :save)
|
6
|
+
|
1
7
|
== [2017-12-23] 1.3.0
|
2
8
|
|
3
9
|
* Use all columns (not just content_columns)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,45 +1,49 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nilify_blanks (1.
|
5
|
-
activerecord (>=
|
6
|
-
activesupport (>=
|
4
|
+
nilify_blanks (1.3.0)
|
5
|
+
activerecord (>= 4.0.0)
|
6
|
+
activesupport (>= 4.0.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
activerecord (
|
14
|
-
activemodel (=
|
15
|
-
activesupport (=
|
16
|
-
|
17
|
-
activesupport (5.1.4)
|
11
|
+
activemodel (6.0.2.1)
|
12
|
+
activesupport (= 6.0.2.1)
|
13
|
+
activerecord (6.0.2.1)
|
14
|
+
activemodel (= 6.0.2.1)
|
15
|
+
activesupport (= 6.0.2.1)
|
16
|
+
activesupport (6.0.2.1)
|
18
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
-
i18n (
|
18
|
+
i18n (>= 0.7, < 2)
|
20
19
|
minitest (~> 5.1)
|
21
20
|
tzinfo (~> 1.1)
|
22
|
-
|
21
|
+
zeitwerk (~> 2.2)
|
22
|
+
appraisal (2.2.0)
|
23
23
|
bundler
|
24
24
|
rake
|
25
25
|
thor (>= 0.14.0)
|
26
|
-
|
27
|
-
|
28
|
-
diff-lcs (1.2.1)
|
26
|
+
concurrent-ruby (1.1.5)
|
27
|
+
diff-lcs (1.3)
|
29
28
|
ffi2-generators (0.1.1)
|
30
|
-
i18n (
|
29
|
+
i18n (1.8.2)
|
31
30
|
concurrent-ruby (~> 1.0)
|
32
|
-
minitest (5.
|
33
|
-
rake (
|
34
|
-
rspec (
|
35
|
-
rspec-core (~>
|
36
|
-
rspec-expectations (~>
|
37
|
-
rspec-mocks (~>
|
38
|
-
rspec-core (
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
31
|
+
minitest (5.14.0)
|
32
|
+
rake (13.0.1)
|
33
|
+
rspec (3.9.0)
|
34
|
+
rspec-core (~> 3.9.0)
|
35
|
+
rspec-expectations (~> 3.9.0)
|
36
|
+
rspec-mocks (~> 3.9.0)
|
37
|
+
rspec-core (3.9.1)
|
38
|
+
rspec-support (~> 3.9.1)
|
39
|
+
rspec-expectations (3.9.1)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.9.0)
|
42
|
+
rspec-mocks (3.9.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-support (3.9.2)
|
46
|
+
rubysl (2.2.0)
|
43
47
|
rubysl-abbrev (~> 2.0)
|
44
48
|
rubysl-base64 (~> 2.0)
|
45
49
|
rubysl-benchmark (~> 2.0)
|
@@ -73,7 +77,7 @@ GEM
|
|
73
77
|
rubysl-io-nonblock (~> 2.0)
|
74
78
|
rubysl-io-wait (~> 2.0)
|
75
79
|
rubysl-ipaddr (~> 2.0)
|
76
|
-
rubysl-irb (~> 2.
|
80
|
+
rubysl-irb (~> 2.1)
|
77
81
|
rubysl-logger (~> 2.0)
|
78
82
|
rubysl-mathn (~> 2.0)
|
79
83
|
rubysl-matrix (~> 2.0)
|
@@ -102,7 +106,6 @@ GEM
|
|
102
106
|
rubysl-pstore (~> 2.0)
|
103
107
|
rubysl-pty (~> 2.0)
|
104
108
|
rubysl-rational (~> 2.0)
|
105
|
-
rubysl-readline (~> 2.0)
|
106
109
|
rubysl-resolv (~> 2.0)
|
107
110
|
rubysl-rexml (~> 2.0)
|
108
111
|
rubysl-rinda (~> 2.0)
|
@@ -125,6 +128,7 @@ GEM
|
|
125
128
|
rubysl-tmpdir (~> 2.0)
|
126
129
|
rubysl-tsort (~> 2.0)
|
127
130
|
rubysl-un (~> 2.0)
|
131
|
+
rubysl-unicode_normalize (~> 2.0)
|
128
132
|
rubysl-uri (~> 2.0)
|
129
133
|
rubysl-weakref (~> 2.0)
|
130
134
|
rubysl-webrick (~> 2.0)
|
@@ -136,22 +140,22 @@ GEM
|
|
136
140
|
rubysl-benchmark (2.0.1)
|
137
141
|
rubysl-bigdecimal (2.0.2)
|
138
142
|
rubysl-cgi (2.0.1)
|
139
|
-
rubysl-cgi-session (2.0
|
143
|
+
rubysl-cgi-session (2.1.0)
|
140
144
|
rubysl-cmath (2.0.0)
|
141
145
|
rubysl-complex (2.0.0)
|
142
146
|
rubysl-continuation (2.0.0)
|
143
|
-
rubysl-coverage (2.
|
147
|
+
rubysl-coverage (2.1)
|
144
148
|
rubysl-csv (2.0.2)
|
145
149
|
rubysl-english (~> 2.0)
|
146
150
|
rubysl-curses (2.0.1)
|
147
|
-
rubysl-date (2.0.
|
151
|
+
rubysl-date (2.0.9)
|
148
152
|
rubysl-delegate (2.0.1)
|
149
|
-
rubysl-digest (2.0.
|
153
|
+
rubysl-digest (2.0.8)
|
150
154
|
rubysl-drb (2.0.1)
|
151
155
|
rubysl-e2mmap (2.0.0)
|
152
156
|
rubysl-english (2.0.0)
|
153
157
|
rubysl-enumerator (2.0.0)
|
154
|
-
rubysl-erb (2.0.
|
158
|
+
rubysl-erb (2.0.2)
|
155
159
|
rubysl-etc (2.0.3)
|
156
160
|
ffi2-generators (~> 0.1)
|
157
161
|
rubysl-expect (2.0.0)
|
@@ -169,19 +173,18 @@ GEM
|
|
169
173
|
rubysl-io-nonblock (2.0.0)
|
170
174
|
rubysl-io-wait (2.0.0)
|
171
175
|
rubysl-ipaddr (2.0.0)
|
172
|
-
rubysl-irb (2.
|
176
|
+
rubysl-irb (2.1.1)
|
173
177
|
rubysl-e2mmap (~> 2.0)
|
174
178
|
rubysl-mathn (~> 2.0)
|
175
|
-
rubysl-readline (~> 2.0)
|
176
179
|
rubysl-thread (~> 2.0)
|
177
|
-
rubysl-logger (2.
|
180
|
+
rubysl-logger (2.1.0)
|
178
181
|
rubysl-mathn (2.0.0)
|
179
182
|
rubysl-matrix (2.1.0)
|
180
183
|
rubysl-e2mmap (~> 2.0)
|
181
|
-
rubysl-mkmf (2.
|
184
|
+
rubysl-mkmf (2.1)
|
182
185
|
rubysl-fileutils (~> 2.0)
|
183
186
|
rubysl-shellwords (~> 2.0)
|
184
|
-
rubysl-monitor (2.
|
187
|
+
rubysl-monitor (2.1)
|
185
188
|
rubysl-mutex_m (2.0.0)
|
186
189
|
rubysl-net-ftp (2.0.1)
|
187
190
|
rubysl-net-http (2.0.4)
|
@@ -197,21 +200,20 @@ GEM
|
|
197
200
|
rubysl-observer (2.0.0)
|
198
201
|
rubysl-open-uri (2.0.0)
|
199
202
|
rubysl-open3 (2.0.0)
|
200
|
-
rubysl-openssl (2.
|
203
|
+
rubysl-openssl (2.10)
|
201
204
|
rubysl-optparse (2.0.1)
|
202
205
|
rubysl-shellwords (~> 2.0)
|
203
|
-
rubysl-ostruct (2.0
|
204
|
-
rubysl-pathname (2.
|
206
|
+
rubysl-ostruct (2.1.0)
|
207
|
+
rubysl-pathname (2.3)
|
205
208
|
rubysl-prettyprint (2.0.3)
|
206
209
|
rubysl-prime (2.0.1)
|
207
210
|
rubysl-profile (2.0.0)
|
208
|
-
rubysl-profiler (2.
|
211
|
+
rubysl-profiler (2.1)
|
209
212
|
rubysl-pstore (2.0.0)
|
210
|
-
rubysl-pty (2.0.
|
213
|
+
rubysl-pty (2.0.3)
|
211
214
|
rubysl-rational (2.0.1)
|
212
|
-
rubysl-
|
213
|
-
rubysl-
|
214
|
-
rubysl-rexml (2.0.2)
|
215
|
+
rubysl-resolv (2.1.2)
|
216
|
+
rubysl-rexml (2.0.4)
|
215
217
|
rubysl-rinda (2.0.1)
|
216
218
|
rubysl-rss (2.0.0)
|
217
219
|
rubysl-scanf (2.0.0)
|
@@ -219,14 +221,15 @@ GEM
|
|
219
221
|
rubysl-set (2.0.1)
|
220
222
|
rubysl-shellwords (2.0.0)
|
221
223
|
rubysl-singleton (2.0.0)
|
222
|
-
rubysl-socket (2.
|
223
|
-
|
224
|
+
rubysl-socket (2.2.1)
|
225
|
+
rubysl-fcntl (~> 2.0)
|
226
|
+
rubysl-stringio (2.3)
|
224
227
|
rubysl-strscan (2.0.0)
|
225
228
|
rubysl-sync (2.0.0)
|
226
|
-
rubysl-syslog (2.0
|
229
|
+
rubysl-syslog (2.1.0)
|
227
230
|
ffi2-generators (~> 0.1)
|
228
231
|
rubysl-tempfile (2.0.1)
|
229
|
-
rubysl-thread (2.
|
232
|
+
rubysl-thread (2.1)
|
230
233
|
rubysl-thwait (2.0.0)
|
231
234
|
rubysl-time (2.0.3)
|
232
235
|
rubysl-timeout (2.0.0)
|
@@ -235,29 +238,31 @@ GEM
|
|
235
238
|
rubysl-un (2.0.0)
|
236
239
|
rubysl-fileutils (~> 2.0)
|
237
240
|
rubysl-optparse (~> 2.0)
|
241
|
+
rubysl-unicode_normalize (2.0)
|
238
242
|
rubysl-uri (2.0.0)
|
239
243
|
rubysl-weakref (2.0.0)
|
240
244
|
rubysl-webrick (2.0.0)
|
241
245
|
rubysl-xmlrpc (2.0.0)
|
242
|
-
rubysl-yaml (2.0
|
246
|
+
rubysl-yaml (2.1.0)
|
243
247
|
rubysl-zlib (2.0.1)
|
244
248
|
sqlite3 (1.3.13)
|
245
|
-
thor (0.
|
249
|
+
thor (0.20.3)
|
246
250
|
thread_safe (0.3.6)
|
247
|
-
tzinfo (1.2.
|
251
|
+
tzinfo (1.2.6)
|
248
252
|
thread_safe (~> 0.1)
|
253
|
+
zeitwerk (2.2.2)
|
249
254
|
|
250
255
|
PLATFORMS
|
251
256
|
ruby
|
252
257
|
|
253
258
|
DEPENDENCIES
|
254
259
|
activerecord-jdbcsqlite3-adapter
|
255
|
-
appraisal (
|
260
|
+
appraisal (>= 1.0.2)
|
256
261
|
nilify_blanks!
|
257
|
-
rake (~>
|
258
|
-
rspec (
|
262
|
+
rake (~> 13.0.1)
|
263
|
+
rspec (>= 3.8.0)
|
259
264
|
rubysl (~> 2.0)
|
260
|
-
sqlite3
|
265
|
+
sqlite3 (~> 1.3.6)
|
261
266
|
|
262
267
|
BUNDLED WITH
|
263
|
-
1.
|
268
|
+
1.17.3
|
data/README.rdoc
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
{<img src="https://secure.travis-ci.org/rubiety/nilify_blanks.png?branch=master" alt="Build Status" />}[http://travis-ci.org/rubiety/nilify_blanks]
|
2
|
-
{<img src="https://gemnasium.com/rubiety/nilify_blanks.png" alt="Dependency Status" />}[https://gemnasium.com/rubiety/nilify_blanks]
|
3
|
-
{<img src="https://codeclimate.com/github/rubiety/nilify_blanks.png" />}[https://codeclimate.com/github/rubiety/nilify_blanks]
|
4
2
|
|
5
3
|
== Nilify Blanks
|
6
4
|
|
@@ -12,10 +10,7 @@ Only attributes responding to blank? with a value of true will be converted to n
|
|
12
10
|
|
13
11
|
== Requirements
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
Due to issues maintaining backwards compatibility, as of v1.2.0 this gem requires ruby 1.9.3 or higher.
|
18
|
-
If you are still using 1.8.7 or 1.9.2, please use the v1.1.0 release.
|
13
|
+
As of v1.4.0, this gem requires Rails 4 and Ruby 2.2 or higher.
|
19
14
|
|
20
15
|
== Install
|
21
16
|
|
@@ -32,22 +27,22 @@ Include the gem using bundler in your Gemfile:
|
|
32
27
|
|
33
28
|
# Checks and converts only text fields in the model
|
34
29
|
class Post < ActiveRecord::Base
|
35
|
-
nilify_blanks :
|
30
|
+
nilify_blanks types: [:text]
|
36
31
|
end
|
37
|
-
|
32
|
+
|
38
33
|
# Checks and converts only the title and author fields
|
39
34
|
class Post < ActiveRecord::Base
|
40
|
-
nilify_blanks :
|
35
|
+
nilify_blanks only: [:author, :title]
|
41
36
|
end
|
42
|
-
|
37
|
+
|
43
38
|
# Checks and converts all fields except for title and author
|
44
39
|
class Post < ActiveRecord::Base
|
45
|
-
nilify_blanks :
|
40
|
+
nilify_blanks except: [:author, :title]
|
46
41
|
end
|
47
42
|
|
48
|
-
# Checks and converts any fields, regardless of
|
43
|
+
# Checks and converts any fields, regardless of their null constraint
|
49
44
|
class Post < ActiveRecord::Base
|
50
|
-
nilify_blanks :
|
45
|
+
nilify_blanks nullables_only: false
|
51
46
|
end
|
52
47
|
|
53
48
|
== Global Usage
|
@@ -62,14 +57,14 @@ Or perhaps just a model namespace base class:
|
|
62
57
|
|
63
58
|
== Specifying a Callback
|
64
59
|
|
65
|
-
Checking uses an ActiveRecord
|
60
|
+
Checking uses an ActiveRecord before_validation callback by default, but you can specify a different callback with the :before option. Any callback will work - just first remove the "before_" prefix from the name.
|
66
61
|
|
67
62
|
class Post < ActiveRecord::Base
|
68
|
-
nilify_blanks :
|
63
|
+
nilify_blanks before: :create
|
69
64
|
end
|
70
|
-
|
71
|
-
class Post < ActiveRecord::
|
72
|
-
nilify_blanks :
|
65
|
+
|
66
|
+
class Post < ActiveRecord::Base
|
67
|
+
nilify_blanks before: :validation_on_update
|
73
68
|
end
|
74
69
|
|
75
70
|
== RSpec Matcher
|
@@ -93,15 +88,16 @@ To ensure for all applicable content columns:
|
|
93
88
|
You can optionally match on options also:
|
94
89
|
|
95
90
|
describe City do
|
96
|
-
it { should nilify_blanks_for(:name, :
|
91
|
+
it { should nilify_blanks_for(:name, before: :create) }
|
97
92
|
end
|
98
93
|
|
99
94
|
describe City do
|
100
|
-
it { should nilify_blanks(:
|
95
|
+
it { should nilify_blanks(before: :create) }
|
101
96
|
end
|
102
97
|
|
103
98
|
== Running Tests
|
104
99
|
|
105
100
|
This gem uses appraisal to test with different versions of the dependencies. See Appraisal first for which versions are tested, then run to test all appraisals:
|
106
101
|
|
102
|
+
$ rake appraisal install
|
107
103
|
$ rake appraisal test
|
data/Rakefile
CHANGED
@@ -1,17 +1,37 @@
|
|
1
|
-
require '
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'appraisal'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
2
5
|
require 'bundler/setup'
|
3
6
|
|
4
7
|
require 'rake'
|
5
8
|
require 'rspec/core/rake_task'
|
6
9
|
|
7
|
-
desc
|
8
|
-
task :
|
10
|
+
desc "Default: run unit tests."
|
11
|
+
task default: [:clean, :all]
|
9
12
|
|
10
|
-
|
11
|
-
|
13
|
+
task test: :spec
|
14
|
+
|
15
|
+
desc "Test this plugin under all supported Rails versions."
|
16
|
+
task :all do |t|
|
17
|
+
if ENV['BUNDLE_GEMFILE']
|
18
|
+
exec('rake spec && cucumber')
|
19
|
+
else
|
20
|
+
exec("rm -f gemfiles/*.lock")
|
21
|
+
Rake::Task["appraisal:gemfiles"].execute
|
22
|
+
Rake::Task["appraisal:install"].execute
|
23
|
+
exec('rake appraisal')
|
24
|
+
end
|
12
25
|
end
|
13
26
|
|
14
|
-
|
27
|
+
desc "Run Specs"
|
28
|
+
RSpec::Core::RakeTask.new(:spec)
|
29
|
+
|
30
|
+
desc "Start an IRB session within this plugin"
|
31
|
+
task :shell do |t|
|
32
|
+
chdir File.dirname(__FILE__)
|
33
|
+
exec 'irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init'
|
34
|
+
end
|
15
35
|
|
16
36
|
desc "Clean up files."
|
17
37
|
task :clean do |t|
|
@@ -19,21 +39,3 @@ task :clean do |t|
|
|
19
39
|
Dir.glob("nilify_blanks-*.gem").each {|f| FileUtils.rm f }
|
20
40
|
Dir.glob("spec/db/*.sqlite3").each {|f| FileUtils.rm f }
|
21
41
|
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
require 'rdoc/task'
|
25
|
-
|
26
|
-
desc "Generate documentation for the plugin."
|
27
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
28
|
-
rdoc.rdoc_dir = "rdoc"
|
29
|
-
rdoc.title = "nilify_blanks"
|
30
|
-
rdoc.options << "--line-numbers" << "--inline-source"
|
31
|
-
rdoc.rdoc_files.include('README')
|
32
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
33
|
-
end
|
34
|
-
rescue LoadError
|
35
|
-
puts 'RDocTask is not supported for this platform'
|
36
|
-
end
|
37
|
-
|
38
|
-
Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"].sort.each { |ext| load ext }
|
39
|
-
|
data/lib/nilify_blanks.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
1
3
|
module NilifyBlanks
|
2
|
-
|
3
|
-
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
class_attribute :nilify_blanks_columns, instance_writer: false, default: []
|
8
|
+
class_attribute :nilify_blanks_options, instance_writer: false, default: nil
|
4
9
|
end
|
5
10
|
|
6
11
|
module ClassMethods
|
7
12
|
DEFAULT_TYPES = [:string, :text, :citext]
|
13
|
+
DEFAULT_CALLBACK = :validation
|
8
14
|
|
9
15
|
@@define_nilify_blank_methods_lock = Mutex.new
|
10
16
|
|
@@ -17,78 +23,53 @@ module NilifyBlanks
|
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
|
-
def inherited(child_class)
|
21
|
-
if instance_variable_get(:@_nilify_blanks_options) and !child_class.instance_variable_get(:@_nilify_blanks_options)
|
22
|
-
child_class.nilify_blanks @_nilify_blanks_options
|
23
|
-
end
|
24
|
-
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
26
|
def nilify_blanks(options = {})
|
29
|
-
|
30
|
-
|
31
|
-
unless included_modules.include?(NilifyBlanks::InstanceMethods)
|
32
|
-
include NilifyBlanks::InstanceMethods
|
33
|
-
end
|
34
|
-
|
35
|
-
@_nilify_blanks_options = options
|
27
|
+
self.nilify_blanks_options = options
|
36
28
|
|
37
29
|
# Normally we wait for rails to define attribute methods, but we could be calling this after this has already been done.
|
38
30
|
# If so, let's just immediately generate nilify blanks methods.
|
39
31
|
#
|
40
|
-
if @attribute_methods_generated
|
41
|
-
define_nilify_blank_methods
|
42
|
-
end
|
43
|
-
|
44
|
-
descendants.each do |subclass|
|
45
|
-
subclass.nilify_blanks @_nilify_blanks_options
|
46
|
-
end
|
32
|
+
define_nilify_blank_methods if @attribute_methods_generated
|
47
33
|
end
|
48
34
|
|
49
35
|
|
50
36
|
private
|
51
37
|
|
52
38
|
def define_nilify_blank_methods
|
53
|
-
return unless
|
54
|
-
return if @nilify_blank_methods_generated
|
39
|
+
return unless nilify_blanks_options
|
55
40
|
|
56
41
|
@@define_nilify_blank_methods_lock.synchronize do
|
57
|
-
options =
|
42
|
+
options = nilify_blanks_options.dup
|
58
43
|
|
44
|
+
options[:before] ||= DEFAULT_CALLBACK
|
59
45
|
options[:only] = Array.wrap(options[:only]).map(&:to_s) if options[:only]
|
60
46
|
options[:except] = Array.wrap(options[:except]).map(&:to_s) if options[:except]
|
61
47
|
options[:types] = options[:types] ? Array.wrap(options[:types]).map(&:to_sym) : DEFAULT_TYPES
|
62
48
|
|
63
|
-
cattr_accessor :nilify_blanks_columns
|
64
|
-
|
65
49
|
if options[:only]
|
66
|
-
|
50
|
+
columns_to_nilify = options[:only].clone
|
67
51
|
elsif options[:nullables_only] == false
|
68
|
-
|
52
|
+
columns_to_nilify = self.columns.select {|c| options[:types].include?(c.type) }.map(&:name).map(&:to_s)
|
69
53
|
else
|
70
|
-
|
54
|
+
columns_to_nilify = self.columns.select(&:null).select {|c| options[:types].include?(c.type) }.map(&:name).map(&:to_s)
|
71
55
|
end
|
72
56
|
|
73
|
-
|
74
|
-
|
57
|
+
columns_to_nilify -= options[:except] if options[:except]
|
58
|
+
|
59
|
+
self.nilify_blanks_columns = columns_to_nilify.map(&:to_s)
|
75
60
|
|
76
|
-
options[:before] ||= :save
|
77
61
|
send("before_#{options[:before]}", :nilify_blanks)
|
78
|
-
@nilify_blanks_methods_generated = true
|
79
62
|
end
|
80
63
|
end
|
81
64
|
end
|
82
65
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
next unless value.respond_to?(:blank?)
|
66
|
+
def nilify_blanks
|
67
|
+
(nilify_blanks_columns || []).each do |column|
|
68
|
+
value = read_attribute(column)
|
69
|
+
next unless value.is_a?(String)
|
70
|
+
next unless value.respond_to?(:blank?)
|
89
71
|
|
90
|
-
|
91
|
-
end
|
72
|
+
write_attribute(column, nil) if value.blank?
|
92
73
|
end
|
93
74
|
end
|
94
75
|
end
|
@@ -20,10 +20,10 @@ Kernel.const_get(rspec_module)::Matchers.define :nilify_blanks_for do |column_na
|
|
20
20
|
match do |model_instance|
|
21
21
|
model_class = model_instance.class
|
22
22
|
model_class.define_attribute_methods
|
23
|
-
model_class.included_modules.include?(NilifyBlanks
|
23
|
+
model_class.included_modules.include?(NilifyBlanks) &&
|
24
24
|
model_class.respond_to?(:nilify_blanks_columns) &&
|
25
25
|
model_class.nilify_blanks_columns.include?(column_name.to_s) &&
|
26
|
-
options.all? {|k, v| model_class.
|
26
|
+
(options || {}).all? {|k, v| model_class.nilify_blanks_options[k] == v }
|
27
27
|
end
|
28
28
|
|
29
29
|
send(failure_message_method) do |_|
|
@@ -37,14 +37,14 @@ end
|
|
37
37
|
|
38
38
|
Kernel.const_get(rspec_module)::Matchers.define :nilify_blanks do |options = {}|
|
39
39
|
match do |model_instance|
|
40
|
-
|
40
|
+
expected_types = options[:types] ? Array.wrap(options[:types]).map(&:to_sym) : NilifyBlanks::ClassMethods::DEFAULT_TYPES
|
41
41
|
|
42
42
|
model_class = model_instance.class
|
43
43
|
model_class.define_attribute_methods
|
44
|
-
model_class.included_modules.include?(NilifyBlanks
|
44
|
+
model_class.included_modules.include?(NilifyBlanks) &&
|
45
45
|
model_class.respond_to?(:nilify_blanks_columns) &&
|
46
|
-
model_class.nilify_blanks_columns == model_class.
|
47
|
-
options.all? {|k, v| model_class.
|
46
|
+
model_class.nilify_blanks_columns == model_class.columns.select(&:null).select {|c| expected_types.include?(c.type) }.map(&:name).map(&:to_s) &&
|
47
|
+
(options || {}).all? {|k, v| model_class.nilify_blanks_options[k] == v }
|
48
48
|
end
|
49
49
|
|
50
50
|
send(failure_message_method) do |_|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module NilifyBlanks
|
2
2
|
if defined?(Rails::Railtie)
|
3
3
|
require "rails"
|
4
|
-
|
4
|
+
|
5
5
|
class Railtie < Rails::Railtie
|
6
6
|
initializer "nilify_blanks.extend_active_record" do
|
7
7
|
ActiveSupport.on_load(:active_record) do
|
@@ -10,7 +10,7 @@ module NilifyBlanks
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
class Railtie
|
15
15
|
def self.insert
|
16
16
|
ActiveRecord::Base.send(:include, NilifyBlanks)
|
data/spec/db/test.sqlite3
CHANGED
Binary file
|
data/spec/examples.txt
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
--------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/nilify_blanks_spec.rb[1:1:1] | passed | 0.00172 seconds |
|
4
|
+
./spec/nilify_blanks_spec.rb[1:1:2] | passed | 0.00248 seconds |
|
5
|
+
./spec/nilify_blanks_spec.rb[1:1:3] | passed | 0.00081 seconds |
|
6
|
+
./spec/nilify_blanks_spec.rb[1:1:4] | passed | 0.00052 seconds |
|
7
|
+
./spec/nilify_blanks_spec.rb[1:1:5] | passed | 0.00158 seconds |
|
8
|
+
./spec/nilify_blanks_spec.rb[1:2:1] | passed | 0.00014 seconds |
|
9
|
+
./spec/nilify_blanks_spec.rb[1:3:1] | passed | 0.00037 seconds |
|
10
|
+
./spec/nilify_blanks_spec.rb[1:3:2] | passed | 0.00026 seconds |
|
11
|
+
./spec/nilify_blanks_spec.rb[1:3:3] | passed | 0.00033 seconds |
|
12
|
+
./spec/nilify_blanks_spec.rb[1:4:1] | passed | 0.00032 seconds |
|
13
|
+
./spec/nilify_blanks_spec.rb[1:4:2] | passed | 0.00016 seconds |
|
14
|
+
./spec/nilify_blanks_spec.rb[1:4:3] | passed | 0.00022 seconds |
|
15
|
+
./spec/nilify_blanks_spec.rb[1:5:1] | passed | 0.0002 seconds |
|
16
|
+
./spec/nilify_blanks_spec.rb[1:5:2] | passed | 0.00016 seconds |
|
17
|
+
./spec/nilify_blanks_spec.rb[1:5:3] | passed | 0.00028 seconds |
|
18
|
+
./spec/nilify_blanks_spec.rb[1:6:1:1] | passed | 0.00091 seconds |
|
19
|
+
./spec/nilify_blanks_spec.rb[1:6:2:1] | passed | 0.00023 seconds |
|
20
|
+
./spec/nilify_blanks_spec.rb[1:6:3:1] | passed | 0.00047 seconds |
|
21
|
+
./spec/nilify_blanks_spec.rb[1:6:4:1] | passed | 0.00041 seconds |
|
22
|
+
./spec/nilify_blanks_spec.rb[1:7:1:1] | passed | 0.00067 seconds |
|
23
|
+
./spec/nilify_blanks_spec.rb[1:7:1:2] | passed | 0.00072 seconds |
|
24
|
+
./spec/nilify_blanks_spec.rb[1:7:1:3] | passed | 0.00072 seconds |
|
25
|
+
./spec/nilify_blanks_spec.rb[1:7:1:4] | passed | 0.00087 seconds |
|
26
|
+
./spec/nilify_blanks_spec.rb[1:7:1:5] | passed | 0.00051 seconds |
|
27
|
+
./spec/nilify_blanks_spec.rb[1:7:1:6] | passed | 0.00036 seconds |
|
28
|
+
./spec/nilify_blanks_spec.rb[1:7:1:7] | passed | 0.00041 seconds |
|
29
|
+
./spec/nilify_blanks_spec.rb[1:7:1:8] | passed | 0.00171 seconds |
|
30
|
+
./spec/nilify_blanks_spec.rb[1:7:2:1:1] | passed | 0.00149 seconds |
|
data/spec/nilify_blanks_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
require "
|
2
|
-
|
3
|
-
describe NilifyBlanks do
|
1
|
+
require "nilify_blanks/matchers"
|
4
2
|
|
3
|
+
RSpec.describe NilifyBlanks do
|
5
4
|
context "Model with nilify_blanks" do
|
6
5
|
before(:all) do
|
7
6
|
class Post < ActiveRecord::Base
|
@@ -13,24 +12,28 @@ describe NilifyBlanks do
|
|
13
12
|
end
|
14
13
|
|
15
14
|
it "should recognize all non-null string, text, citext columns" do
|
16
|
-
Post.nilify_blanks_columns.
|
15
|
+
expect(Post.nilify_blanks_columns).to eq(['first_name', 'title', 'summary', 'body', 'slug', 'blog_id'])
|
17
16
|
end
|
18
17
|
|
19
18
|
it "should convert all blanks to nils" do
|
20
|
-
@post.first_name.
|
21
|
-
@post.title.
|
22
|
-
@post.summary.
|
23
|
-
@post.body.
|
24
|
-
@post.slug.
|
25
|
-
@post.blog_id.
|
19
|
+
expect(@post.first_name).to be_nil
|
20
|
+
expect(@post.title).to be_nil
|
21
|
+
expect(@post.summary).to be_nil
|
22
|
+
expect(@post.body).to be_nil
|
23
|
+
expect(@post.slug).to be_nil
|
24
|
+
expect(@post.blog_id).to be_nil
|
26
25
|
end
|
27
26
|
|
28
27
|
it "should leave not-null last name field alone" do
|
29
|
-
@post.last_name.
|
28
|
+
expect(@post.last_name).to eq("")
|
30
29
|
end
|
31
30
|
|
32
31
|
it "should leave integer views field alone" do
|
33
|
-
@post.views.
|
32
|
+
expect(@post.views).to eq(0)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should not nilify non-null column" do
|
36
|
+
expect(@post.class.nilify_blanks_columns).to_not include('last_name')
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
@@ -45,7 +48,7 @@ describe NilifyBlanks do
|
|
45
48
|
end
|
46
49
|
|
47
50
|
it "should recognize all (even null) string, text, citext columns" do
|
48
|
-
PostWithNullables.nilify_blanks_columns.
|
51
|
+
expect(PostWithNullables.nilify_blanks_columns).to eq(['first_name', 'last_name', 'title', 'summary', 'body', 'slug', 'blog_id'])
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
@@ -67,20 +70,20 @@ describe NilifyBlanks do
|
|
67
70
|
it "should recognize all non-null text only columns" do
|
68
71
|
expected_types = ['summary', 'body']
|
69
72
|
expected_types << 'slug' unless citext_supported
|
70
|
-
PostOnlyText.nilify_blanks_columns.
|
73
|
+
expect(PostOnlyText.nilify_blanks_columns).to eq(expected_types)
|
71
74
|
end
|
72
75
|
|
73
76
|
it "should convert all blanks to nils" do
|
74
|
-
@post.summary.
|
75
|
-
@post.body.
|
76
|
-
@post.slug.
|
77
|
+
expect(@post.summary).to be_nil
|
78
|
+
expect(@post.body).to be_nil
|
79
|
+
expect(@post.slug).to be_nil unless citext_supported
|
77
80
|
end
|
78
81
|
|
79
82
|
it "should leave not-null string fields alone" do
|
80
|
-
@post.first_name.
|
81
|
-
@post.last_name.
|
82
|
-
@post.title.
|
83
|
-
@post.slug.
|
83
|
+
expect(@post.first_name).to eq("")
|
84
|
+
expect(@post.last_name).to eq("")
|
85
|
+
expect(@post.title).to eq("")
|
86
|
+
expect(@post.slug).to eq("") if citext_supported
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
@@ -96,18 +99,18 @@ describe NilifyBlanks do
|
|
96
99
|
end
|
97
100
|
|
98
101
|
it "should recognize only first_name and title" do
|
99
|
-
PostOnlyFirstNameAndTitle.nilify_blanks_columns.
|
102
|
+
expect(PostOnlyFirstNameAndTitle.nilify_blanks_columns).to eq(['first_name', 'title'])
|
100
103
|
end
|
101
104
|
|
102
105
|
it "should convert first_name and title blanks to nils" do
|
103
|
-
@post.first_name.
|
104
|
-
@post.title.
|
106
|
+
expect(@post.first_name).to be_nil
|
107
|
+
expect(@post.title).to be_nil
|
105
108
|
end
|
106
109
|
|
107
110
|
it "should leave other fields alone" do
|
108
|
-
@post.summary.
|
109
|
-
@post.body.
|
110
|
-
@post.slug.
|
111
|
+
expect(@post.summary).to eq("")
|
112
|
+
expect(@post.body).to eq("")
|
113
|
+
expect(@post.slug).to eq("")
|
111
114
|
end
|
112
115
|
end
|
113
116
|
|
@@ -123,18 +126,18 @@ describe NilifyBlanks do
|
|
123
126
|
end
|
124
127
|
|
125
128
|
it "should recognize only summary, body, and views" do
|
126
|
-
PostExceptFirstNameAndTitle.nilify_blanks_columns.
|
129
|
+
expect(PostExceptFirstNameAndTitle.nilify_blanks_columns).to eq(['summary', 'body', 'slug'])
|
127
130
|
end
|
128
131
|
|
129
132
|
it "should convert summary and body blanks to nils" do
|
130
|
-
@post.summary.
|
131
|
-
@post.body.
|
132
|
-
@post.slug.
|
133
|
+
expect(@post.summary).to be_nil
|
134
|
+
expect(@post.body).to be_nil
|
135
|
+
expect(@post.slug).to be_nil
|
133
136
|
end
|
134
137
|
|
135
138
|
it "should leave other fields alone" do
|
136
|
-
@post.first_name.
|
137
|
-
@post.title.
|
139
|
+
expect(@post.first_name).to eq("")
|
140
|
+
expect(@post.title).to eq("")
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
@@ -158,7 +161,7 @@ describe NilifyBlanks do
|
|
158
161
|
end
|
159
162
|
|
160
163
|
it "should convert all blanks to nils" do
|
161
|
-
@post.first_name.
|
164
|
+
expect(@post.first_name).to be_nil
|
162
165
|
end
|
163
166
|
end
|
164
167
|
|
@@ -181,7 +184,7 @@ describe NilifyBlanks do
|
|
181
184
|
end
|
182
185
|
|
183
186
|
it "should convert all blanks to nils" do
|
184
|
-
@post.first_name.
|
187
|
+
expect(@post.first_name).to be_nil
|
185
188
|
end
|
186
189
|
end
|
187
190
|
|
@@ -198,9 +201,64 @@ describe NilifyBlanks do
|
|
198
201
|
end
|
199
202
|
|
200
203
|
it "should convert all blanks to nils" do
|
201
|
-
@post.first_name.
|
204
|
+
expect(@post.first_name).to be_nil
|
202
205
|
end
|
203
206
|
end
|
204
207
|
|
208
|
+
context "Namespaced Base Class with nilify_blanks with overrides applied after definition" do
|
209
|
+
before(:all) do
|
210
|
+
ActiveRecord::Base.nilify_blanks
|
211
|
+
|
212
|
+
class InheritedPost < ActiveRecord::Base
|
213
|
+
self.table_name = "posts"
|
214
|
+
|
215
|
+
nilify_blanks except: [:first_name]
|
216
|
+
end
|
217
|
+
|
218
|
+
@post = InheritedPost.new(:first_name => '', :last_name => '', :title => '', :summary => '', :body => '', :slug => '', :views => 0)
|
219
|
+
@post.save
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should convert all blanks to nils" do
|
223
|
+
expect(@post.first_name).to_not be_nil
|
224
|
+
expect(@post.title).to be_nil
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
describe "matchers" do
|
230
|
+
describe "nilify_blanks_for" do
|
231
|
+
subject { Post.new }
|
232
|
+
|
233
|
+
before(:all) do
|
234
|
+
class Post < ActiveRecord::Base
|
235
|
+
nilify_blanks
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
it { is_expected.to nilify_blanks_for(:first_name) }
|
240
|
+
it { is_expected.to nilify_blanks_for(:title) }
|
241
|
+
it { is_expected.to nilify_blanks_for(:summary) }
|
242
|
+
it { is_expected.to nilify_blanks_for(:body) }
|
243
|
+
it { is_expected.to nilify_blanks_for(:slug) }
|
244
|
+
it { is_expected.to nilify_blanks_for(:blog_id) }
|
245
|
+
|
246
|
+
it { is_expected.to_not nilify_blanks_for(:id) }
|
247
|
+
it { is_expected.to_not nilify_blanks_for(:last_name) }
|
248
|
+
end
|
249
|
+
|
250
|
+
describe "nilify_blanks" do
|
251
|
+
subject { Post.new }
|
252
|
+
|
253
|
+
before(:all) do
|
254
|
+
class Post < ActiveRecord::Base
|
255
|
+
nilify_blanks
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
context "foreign key column is nilified" do
|
260
|
+
it { is_expected.to nilify_blanks }
|
261
|
+
end
|
262
|
+
end
|
205
263
|
end
|
206
264
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -13,3 +13,28 @@ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'
|
|
13
13
|
load(File.dirname(__FILE__) + "/db/schema.rb")
|
14
14
|
|
15
15
|
require File.dirname(__FILE__) + '/../init'
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.define_derived_metadata do |meta|
|
19
|
+
meta[:aggregate_failures] = true unless meta.key?(:aggregate_failures)
|
20
|
+
end
|
21
|
+
|
22
|
+
config.disable_monkey_patching!
|
23
|
+
|
24
|
+
config.expect_with :rspec do |expectations|
|
25
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
26
|
+
end
|
27
|
+
|
28
|
+
config.mock_with :rspec do |mocks|
|
29
|
+
mocks.verify_partial_doubles = true
|
30
|
+
end
|
31
|
+
|
32
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
33
|
+
config.filter_run_when_matching :focus
|
34
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
35
|
+
|
36
|
+
# config.order = :random
|
37
|
+
# Kernel.srand config.seed
|
38
|
+
|
39
|
+
# config.warnings = true
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nilify_blanks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Hughes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,82 +16,82 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 13.0.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 13.0.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 3.8.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 3.8.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: appraisal
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.0.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.0.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: sqlite3
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 1.3.6
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.3.6
|
97
97
|
description: Often times you'll end up with empty strings where you really want nil
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- spec/db/database.yml
|
118
118
|
- spec/db/schema.rb
|
119
119
|
- spec/db/test.sqlite3
|
120
|
+
- spec/examples.txt
|
120
121
|
- spec/nilify_blanks_spec.rb
|
121
122
|
- spec/spec_helper.rb
|
122
123
|
homepage: http://github.com/rubiety/nilify_blanks
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
140
|
version: 1.3.4
|
140
141
|
requirements: []
|
141
142
|
rubyforge_project: nilify_blanks
|
142
|
-
rubygems_version: 2.6
|
143
|
+
rubygems_version: 2.7.6
|
143
144
|
signing_key:
|
144
145
|
specification_version: 4
|
145
146
|
summary: Auto-convert blank fields to nil.
|