blank_empty_nil_filters 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 64e75e1a9ee5dcae8ca6f3e8b538765f8350634b
4
+ data.tar.gz: 152de1254ee4cb1e9a5874e8d8f7203afa325539
5
+ SHA512:
6
+ metadata.gz: e3168af58aac78538ff99afad4d81e56ce78bcf6c23e2c3999d18a78971870512bb057cd2560972c6ddf4d0c6e3d1fc8e9577ff9cce21e4f6f110b883607673b
7
+ data.tar.gz: eccbcf9941d4a2f043503043e941094b08b3b960a28cf2c2073ac495b337a7fe65ff020a600a7281ce28a6624a36a0ab9f8dd0a2d8f67f210b44fd2d010c2fd8
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,141 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ blank_empty_nil_filters (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (5.2.3)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ ast (2.4.0)
15
+ builder (3.2.3)
16
+ byebug (11.0.1)
17
+ coderay (1.1.2)
18
+ concurrent-ruby (1.1.5)
19
+ diff-lcs (1.3)
20
+ docile (1.3.1)
21
+ ffi (1.10.0)
22
+ formatador (0.2.5)
23
+ fuubar (2.3.2)
24
+ rspec-core (~> 3.0)
25
+ ruby-progressbar (~> 1.4)
26
+ guard (2.15.0)
27
+ formatador (>= 0.2.4)
28
+ listen (>= 2.7, < 4.0)
29
+ lumberjack (>= 1.0.12, < 2.0)
30
+ nenv (~> 0.1)
31
+ notiffany (~> 0.0)
32
+ pry (>= 0.9.12)
33
+ shellany (~> 0.0)
34
+ thor (>= 0.18.1)
35
+ guard-compat (1.2.1)
36
+ guard-rspec (4.7.3)
37
+ guard (~> 2.1)
38
+ guard-compat (~> 1.1)
39
+ rspec (>= 2.99.0, < 4.0)
40
+ guard-yard (2.2.1)
41
+ guard (>= 1.1.0)
42
+ yard (>= 0.7.0)
43
+ i18n (1.6.0)
44
+ concurrent-ruby (~> 1.0)
45
+ jaro_winkler (1.5.2)
46
+ json (2.2.0)
47
+ listen (3.1.5)
48
+ rb-fsevent (~> 0.9, >= 0.9.4)
49
+ rb-inotify (~> 0.9, >= 0.9.7)
50
+ ruby_dep (~> 1.2)
51
+ lumberjack (1.0.13)
52
+ method_source (0.9.2)
53
+ minitest (5.11.3)
54
+ nenv (0.3.0)
55
+ notiffany (0.1.1)
56
+ nenv (~> 0.1)
57
+ shellany (~> 0.0)
58
+ parallel (1.17.0)
59
+ parser (2.6.2.1)
60
+ ast (~> 2.4.0)
61
+ pry (0.12.2)
62
+ coderay (~> 1.1.0)
63
+ method_source (~> 0.9.0)
64
+ pry-byebug (3.7.0)
65
+ byebug (~> 11.0)
66
+ pry (~> 0.10)
67
+ psych (3.1.0)
68
+ rainbow (3.0.0)
69
+ rake (12.3.2)
70
+ rb-fsevent (0.10.3)
71
+ rb-inotify (0.10.0)
72
+ ffi (~> 1.0)
73
+ redcarpet (3.4.0)
74
+ rspec (3.8.0)
75
+ rspec-core (~> 3.8.0)
76
+ rspec-expectations (~> 3.8.0)
77
+ rspec-mocks (~> 3.8.0)
78
+ rspec-core (3.8.0)
79
+ rspec-support (~> 3.8.0)
80
+ rspec-expectations (3.8.2)
81
+ diff-lcs (>= 1.2.0, < 2.0)
82
+ rspec-support (~> 3.8.0)
83
+ rspec-mocks (3.8.0)
84
+ diff-lcs (>= 1.2.0, < 2.0)
85
+ rspec-support (~> 3.8.0)
86
+ rspec-support (3.8.0)
87
+ rspec_junit (4.0.4)
88
+ builder (>= 3.2.2)
89
+ rspec (>= 3.3.0)
90
+ rspec_junit_formatter (0.4.1)
91
+ rspec-core (>= 2, < 4, != 2.12.0)
92
+ rubocop (0.67.2)
93
+ jaro_winkler (~> 1.5.1)
94
+ parallel (~> 1.10)
95
+ parser (>= 2.5, != 2.5.1.1)
96
+ psych (>= 3.1.0)
97
+ rainbow (>= 2.2.2, < 4.0)
98
+ ruby-progressbar (~> 1.7)
99
+ unicode-display_width (>= 1.4.0, < 1.6)
100
+ ruby-progressbar (1.10.0)
101
+ ruby_dep (1.5.0)
102
+ shellany (0.0.1)
103
+ simplecov (0.16.1)
104
+ docile (~> 1.1)
105
+ json (>= 1.8, < 3)
106
+ simplecov-html (~> 0.10.0)
107
+ simplecov-html (0.10.2)
108
+ spring (2.0.2)
109
+ activesupport (>= 4.2)
110
+ terminal-notifier-guard (1.7.0)
111
+ thor (0.20.3)
112
+ thread_safe (0.3.6)
113
+ tzinfo (1.2.5)
114
+ thread_safe (~> 0.1)
115
+ unicode-display_width (1.5.0)
116
+ yard (0.9.19)
117
+
118
+ PLATFORMS
119
+ ruby
120
+
121
+ DEPENDENCIES
122
+ blank_empty_nil_filters!
123
+ bundler
124
+ fuubar
125
+ guard
126
+ guard-rspec
127
+ guard-yard
128
+ pry-byebug
129
+ rake
130
+ redcarpet
131
+ rspec
132
+ rspec_junit
133
+ rspec_junit_formatter
134
+ rubocop
135
+ simplecov
136
+ spring
137
+ terminal-notifier-guard
138
+ yard
139
+
140
+ BUNDLED WITH
141
+ 2.0.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Alan Stebbens
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT LICENSE
2
+
3
+ Copyright (c) 2019 Alan Stebbens <aks@stebbens.org>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,228 @@
1
+ # blank_empty_nil_filters
2
+
3
+ Ruby gem to extend Hash and Array with filters for blank, empty, and nil values.
4
+
5
+ Build status: [![CircleCI](https://circleci.com/gh/aks/blank_empty_nil_filters/tree/master.svg?style=svg)](https://circleci.com/gh/aks/blank_empty_nil_filters/tree/master)
6
+
7
+ This module creates new methods to be prepended to the Array, Hash, String,
8
+ and Object classes to implement recursive filters for _blank_, _empty_, and
9
+ nil values.
10
+
11
+ Note: `ActiveSupport` provides _some_ of these methods, but in general is a *much* larger body
12
+ of code. This module are only those methods related to "blank", "empty" or nil. Also,
13
+ `ActiveSupport` uses `Regexp` `match` to determine blankness, while this code uses a
14
+ non-destructive `strip`, which is both faster and less sensitive to non-UTF8 string error
15
+ conditions.
16
+
17
+ In general an _empty_ value has zero length, and a _blank_ value is either empty or has
18
+ all blank values (e.g., `to_s.strip.length.zero?`)
19
+
20
+ In the descriptions below, `aoh` is an `Array` or `Hash` object.
21
+
22
+ ## Installation
23
+
24
+ Add this line to your application's `Gemfile`:
25
+
26
+ ```ruby
27
+ gem 'blank_empty_nil_filters'
28
+ ```
29
+
30
+ And then execute:
31
+
32
+ $ bundle
33
+
34
+ Or install it yourself as:
35
+
36
+ $ gem install blank_empty_nil_filters
37
+
38
+ ## Usage:
39
+
40
+ ```ruby
41
+ require 'blank_empty_nil_filters'
42
+
43
+ hash.no_empty_values # exclude key/value pairs where the value is empty
44
+ array.no_blank_values # the array without blank values (or sub-values)
45
+
46
+ hash.non_blank_value_keys # keys associated with non-blank values
47
+ hash.blank_value_keys # keys associated with blank values
48
+
49
+ obj.is_empty? # true if the object is nil or has length == 0
50
+ obj.is_blank? # true if the object is nil, empty or all whitespace
51
+ ```
52
+
53
+ These are _recursive_ filters: nested arrays or hashes are processed automatically
54
+
55
+ ```ruby
56
+ aoh.no_empty_values # items without zero-sized values
57
+ aoh.no_blank_values # items without zero-sized or blank values
58
+ aoh.no_nil_values # items without nil values (a recursive .compact)
59
+
60
+ hash.only_empty_values # hash items with only empty values
61
+ hash.only_blank_values # hash items with only blank values
62
+ hash.only_nil_values # hash items with only nil values
63
+
64
+ hash.empty_value_keys # keys from empty values
65
+ hash.blank_value_keys # keys from blank values
66
+ hash.nil_value_keys # keys from nil values
67
+ ```
68
+
69
+ All of the `no_*` methods have aliases of `reject_*`. For example, `reject_empty_values`.
70
+ Some folks prefer the shorter names, some prefer the longer ones. Take your pick.
71
+
72
+ ```ruby
73
+ aoh.reject_empty_values # aoh.no_empty_values
74
+ aoh.reject_blank_values # aoh.no_blank_values
75
+ aoh.reject_nil_values # aoh.no_nil_values
76
+ ```
77
+
78
+ All of the above methods are wrappers around two general purpose methods:
79
+
80
+ ```ruby
81
+ aoh.reject_values(:condition_method) # reject items matching :condition_method
82
+ aoh.select_values(:condition_method) # select items matching :condition_method
83
+ ```
84
+
85
+
86
+ The methods below are used with the general purpose methods to form the special-case filters.
87
+
88
+ ```ruby
89
+ obj.is_empty? # true if object is nil or has zero size
90
+ obj.is_blank? # true if object is nil, has zero size or is blank (whitespace strings)
91
+ obj.is_nil? # object.nil?
92
+
93
+ obj.non_empty? # true if object is not nil and has non-zero size
94
+ obj.non_blank? # true if object is not nil and has non-zero size, and is not blank
95
+ obj.non_nil? # !object.nil?
96
+ ```
97
+
98
+ For _hash_ or _array_ objects, `is_empty?` and `is_blank?` work recursively on the object
99
+ elements, and the result is true only if true at every level.
100
+
101
+ There are also convenience methods to select the keys from filtered hash items:
102
+
103
+ ```ruby
104
+ hash.nil_value_keys => hash.only_nil_values.keys
105
+ hash.empty_value_keys => hash.only_empty_values.keys
106
+ hash.blank_value_keys => hash.only_blank_values.keys
107
+
108
+ hash.non_nil_value_keys => hash.no_nil_values.keys
109
+ hash.non_empty_value_keys => hash.no_empty_values.keys
110
+ hash.non_blank_value_keys => hash.no_blank_values.keys
111
+ ```
112
+
113
+ ## Examples:
114
+
115
+ ### Hash Filters
116
+
117
+ The most common usage of `no_empty_values` is with hashes of parameters, which are formed from
118
+ many variables, and then the empty or blank ones can be easily filtered out of the hash:
119
+
120
+ ```ruby
121
+ { 'Input' => {
122
+ 'Path' => params[:path],
123
+ 'Workspace' => params[:workspace],
124
+ 'Source' => params[:source],
125
+ },
126
+ 'Output' => {
127
+ 'Type' => params[:type],
128
+ 'Headers' => params[:headers],
129
+ }
130
+ }.no_empty_values
131
+ ```
132
+
133
+ With `params` containing:
134
+
135
+ ```ruby
136
+ params = { source: 'source-content', type: :pdf }
137
+ ```
138
+
139
+ The `no_empty_values` would yield the following hash:
140
+
141
+ ```ruby
142
+ { 'Input' => { 'Source' => "source-content" }, 'Output' => { 'Type' => :pdf } }
143
+ ```
144
+
145
+ If the `params` hash were missing both `:type` and `:headers`, the result would be:
146
+
147
+ ```ruby
148
+ { 'Input' => { 'Source' => "source-content" } }
149
+ ```
150
+
151
+ Another example:
152
+
153
+ ```ruby
154
+ params = { file: ' ', type: :pdf, pattern: nil, dest: ''}
155
+ params.no_nil_values => { file: ' ', type: :pdf, dest: '' }
156
+ params.no_empty_values => { file: ' ', type: :pdf }
157
+ params.no_blank_values => { type: :pdf }
158
+ ```
159
+
160
+ #### Finding keys with empty values
161
+
162
+ Sometimes, it's not the key-value pairs that are non-empty that are desired; instead,
163
+ the programmer often wants the keys with empty, blank, or nil values, _(e.g., so they can
164
+ be reported on)_.
165
+
166
+ ```ruby
167
+ params = { file: ' ', type: :pdf, pattern: nil, dest: ''}
168
+ params.nil_value_keys => [:pattern]
169
+ params.empty_value_keys => [:pattern, :dest]
170
+ params.blank_value_keys => [:file, :pattern, :dest]
171
+ ```
172
+
173
+ ### Array Filters
174
+
175
+ To filter out empty (zero-length) values from an array:
176
+
177
+ ```ruby
178
+ [:1 '' nil :2].no_empty_values => [:1 :2]
179
+
180
+ [:1 ['' :b] nil :2 ['' '']].no_empty_values => [:1 [:b] :2]
181
+ ```
182
+
183
+ Note that the filter is recursive, and if a sub-array is entirely empty, it is filtered out also _(because it also has zero length, after its items have been filtered)_.
184
+
185
+ The `nil` is considered an "empty" value.
186
+
187
+ To filter out _blank_ values from an array:
188
+
189
+ ```ruby
190
+ [:1 " " " " nil ['' ' '] :2].no_blank_values => [:1 :2]
191
+ ```
192
+
193
+ ## Testing
194
+
195
+ There is an `rspec`-style test in the `spec` directory, the perusal of which will also provide
196
+ some examples of usage.
197
+
198
+ The rspec-style tests are normally run under the `fuubar` formatter gem which shows an incremental summary on a single line. The
199
+ tests can be run with `rake` or with `rspec`:
200
+
201
+ bundle exec rake spec
202
+
203
+ or
204
+
205
+ bundle exec rspec
206
+
207
+ However, if you wish to see all of the usual "documentation" style output, use the `-f doc` option on the `rspec` invocation:
208
+
209
+ bundle exec rspec -f doc
210
+
211
+ ## Development
212
+
213
+ After checking out the repo, run `rake spec` to run the tests.
214
+
215
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
216
+
217
+
218
+ ## Contributing
219
+
220
+ Bug reports and pull requests are welcome on GitHub at https://github.com/aks/blank_empty_nil_filters
221
+
222
+ ## Author
223
+
224
+ Alan K. Stebbens <aks@stebbens.org>
225
+
226
+ ## License
227
+
228
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,41 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require 'yard'
4
+
5
+ # Local CI testing
6
+
7
+ namespace :ci do
8
+ desc "Check CIRCLECI config"
9
+ task :check do
10
+ sh "circleci config validate", verbose: true
11
+ end
12
+
13
+ desc "Run CIRCLECI config locally"
14
+ task :local do
15
+ sh "circleci local execute", verbose: true
16
+ end
17
+ end
18
+
19
+ # add spec unit tests
20
+
21
+ RSpec::Core::RakeTask.new(:spec)
22
+
23
+ # add spec extensions
24
+
25
+ namespace :spec do
26
+ # add code coverage
27
+
28
+ desc "run Simplecov"
29
+ task :coverage do
30
+ sh 'CODE_COVERAGE=1 bundle exec rake spec'
31
+ end
32
+ end
33
+
34
+ # add yard task
35
+
36
+ YARD::Rake::YardocTask.new do |t|
37
+ t.files = ['README.md', 'lib/**/*.rb']
38
+ t.stats_options = ['--list-undoc']
39
+ end
40
+
41
+ task default: :spec
@@ -0,0 +1,195 @@
1
+ # frozen_string_literal: true
2
+
3
+ # See README.me for the descriptions.
4
+
5
+ module BlankEmptyNilFilters
6
+ module ArrayExtensions
7
+ def no_empty_values
8
+ reject_values(:is_empty?)
9
+ end
10
+ alias reject_empty_values no_empty_values
11
+
12
+ def no_blank_values
13
+ reject_values(:is_blank?)
14
+ end
15
+ alias reject_blank_values no_blank_values
16
+
17
+ def no_nil_values
18
+ reject_values(:nil?)
19
+ end
20
+ alias reject_nil_values no_nil_values
21
+
22
+ def only_empty_values
23
+ select_values(:is_empty?)
24
+ end
25
+
26
+ def only_blank_values
27
+ select_values(:is_blank?)
28
+ end
29
+
30
+ def only_nil_values
31
+ select_values(:is_nil?)
32
+ end
33
+
34
+ def is_empty?
35
+ length.zero? || reject_empty_values.length.zero?
36
+ end
37
+
38
+ def is_blank?
39
+ is_empty? || reject_blank_values.length.zero?
40
+ end
41
+
42
+ def reject_values(filter)
43
+ map { |val| val.respond_to?(:reject_values) ? val.reject_values(filter) : val }
44
+ .reject { |val| val.send(filter) }
45
+ end
46
+ alias no_values reject_values
47
+
48
+ def select_values(filter)
49
+ map { |val| val.respond_to?(:select_values) ? val.select_values(filter) : val }
50
+ .select { |val| val.send(filter) }
51
+ end
52
+ alias only_values select_values
53
+ end
54
+
55
+ module HashExtensions
56
+ def no_empty_values
57
+ reject_values(:is_empty?)
58
+ end
59
+ alias reject_empty_values no_empty_values
60
+
61
+ def only_empty_values
62
+ select_values(:is_empty?)
63
+ end
64
+ alias select_empty_values only_empty_values
65
+
66
+ def no_blank_values
67
+ reject_values(:is_blank?)
68
+ end
69
+ alias reject_blank_values no_blank_values
70
+
71
+ def only_blank_values
72
+ select_values(:is_blank?)
73
+ end
74
+ alias select_blank_values only_blank_values
75
+
76
+ def no_nil_values
77
+ reject_values(:nil?)
78
+ end
79
+ alias reject_nil_values no_nil_values
80
+
81
+ def only_nil_values
82
+ select_values(:nil?)
83
+ end
84
+ alias select_nil_values only_nil_values
85
+
86
+ def empty_value_keys
87
+ only_empty_values.keys
88
+ end
89
+
90
+ def blank_value_keys
91
+ only_blank_values.key
92
+ end
93
+
94
+ def nil_value_keys
95
+ only_nil_values.keys
96
+ end
97
+
98
+ def non_empty_value_keys
99
+ no_empty_values.key
100
+ end
101
+
102
+ def non_blank_value_keys
103
+ no_blank_values.keys
104
+ end
105
+
106
+ def non_nil_value_keys
107
+ no_nil_values.keys
108
+ end
109
+
110
+ def is_empty?
111
+ length.zero? || no_empty_values.length.zero?
112
+ end
113
+
114
+ def is_blank?
115
+ length.zero? || reject_blank_values.length.zero?
116
+ end
117
+
118
+ def reject_values(filter)
119
+ dup.transform_values { |val| val.respond_to?(:reject_values) ? val.reject_values(filter) : val }
120
+ .reject { |_key, val| val.send(filter) }
121
+ end
122
+
123
+ def select_values(filter)
124
+ dup.transform_values { |val| val.respond_to?(:select_values) ? val.select_values(filter) : val }
125
+ .select { |_key, val| val.send(filter) }
126
+ end
127
+ end
128
+
129
+ module StringExtensions
130
+ def is_empty?
131
+ length.zero?
132
+ end
133
+
134
+ def is_blank?
135
+ is_empty? || strip.length.zero?
136
+ end
137
+ end
138
+
139
+ module NilClassExtensions
140
+ def is_empty?
141
+ true
142
+ end
143
+
144
+ def is_blank?
145
+ true
146
+ end
147
+
148
+ def is_nil?
149
+ true
150
+ end
151
+ end
152
+
153
+ module ObjectExtensions
154
+ def is_empty?
155
+ if nil?
156
+ true
157
+ elsif respond_to?(:length) && Numeric === length
158
+ length.zero?
159
+ elsif respond_to?(:size) && Numeric === size
160
+ size.zero?
161
+ else
162
+ false
163
+ end
164
+ end
165
+
166
+ def non_empty?
167
+ !is_empty?
168
+ end
169
+
170
+ def is_blank?
171
+ is_empty? || to_s.is_blank?
172
+ end
173
+
174
+ def non_blank?
175
+ !is_blank?
176
+ end
177
+
178
+ def non_nil?
179
+ !nil?
180
+ end
181
+
182
+ def is_nil?
183
+ nil?
184
+ end
185
+ end
186
+ end
187
+
188
+ require_relative 'blank_empty_nil_filters/version'
189
+
190
+ # prepend these extension methods on these classes
191
+ Array.prepend BlankEmptyNilFilters::ArrayExtensions
192
+ Hash.prepend BlankEmptyNilFilters::HashExtensions
193
+ String.prepend BlankEmptyNilFilters::StringExtensions
194
+ NilClass.prepend BlankEmptyNilFilters::NilClassExtensions
195
+ Object.prepend BlankEmptyNilFilters::ObjectExtensions
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlankEmptyNilFilters
4
+ VERSION = '0.1.0'
5
+ end
metadata ADDED
@@ -0,0 +1,280 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blank_empty_nil_filters
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alan Stebbens
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-04-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: fuubar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard
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: guard-rspec
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: guard-yard
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: pry-byebug
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
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: redcarpet
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec_junit
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec_junit_formatter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: simplecov
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: spring
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: terminal-notifier-guard
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: yard
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ description: |
238
+ Extentions for convenient filtering of blank, empty, and nil values from
239
+ Hash and Array instances.
240
+ email:
241
+ - aks@stebbens.org
242
+ executables: []
243
+ extensions: []
244
+ extra_rdoc_files: []
245
+ files:
246
+ - Gemfile
247
+ - Gemfile.lock
248
+ - LICENSE
249
+ - LICENSE.md
250
+ - README.md
251
+ - Rakefile
252
+ - lib/blank_empty_nil_filters.rb
253
+ - lib/blank_empty_nil_filters/version.rb
254
+ homepage: https://github.com/aks/blank_empty_nil_filters
255
+ licenses:
256
+ - MIT
257
+ metadata: {}
258
+ post_install_message:
259
+ rdoc_options: []
260
+ require_paths:
261
+ - lib
262
+ required_ruby_version: !ruby/object:Gem::Requirement
263
+ requirements:
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ version: '0'
267
+ required_rubygems_version: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ requirements: []
273
+ rubyforge_project:
274
+ rubygems_version: 2.6.14
275
+ signing_key:
276
+ specification_version: 4
277
+ summary: '["Extensions for filtering empty, blank, and nil values from Hashes and
278
+ Arrays", "Extentions for convenient filtering of blank, empty, and nil values from\nHash
279
+ and Array instances.\n"]'
280
+ test_files: []