gorilla_patch 4.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +144 -0
- data/LICENSE.txt +21 -0
- data/README.md +186 -0
- data/lib/gorilla_patch/blank.rb +7 -0
- data/lib/gorilla_patch/deep_dup.rb +11 -0
- data/lib/gorilla_patch/deep_merge.rb +1 -1
- data/lib/gorilla_patch/except.rb +4 -2
- data/lib/gorilla_patch/inflections.rb +6 -5
- data/lib/gorilla_patch/module_parent.rb +1 -1
- data/lib/gorilla_patch/truncate.rb +2 -3
- data/lib/gorilla_patch/version.rb +1 -1
- data/lib/gorilla_patch.rb +1 -1
- metadata +94 -27
- data/lib/gorilla_patch/compact.rb +0 -16
- data/lib/gorilla_patch/cover.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed8c046c84cd4209b31eb262257fb35d0dad797b11dfa504ae5a10082b37ebc8
|
4
|
+
data.tar.gz: 29c5098cae353f51377a7e3d519242db90fab7db9f0656f88409934f8d50e392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f553749b169cfad439f90016a3bc8c9bbf68a9fbfd0bef473a1007b43f71a2a3033ad7ef339f174de506d0cb5d3cc79f0aec0d32c23b7382a4082a49b293818
|
7
|
+
data.tar.gz: 7d196168b34603c9fad90084ebfaedef0d550e731d045da6681babac50324a6c6dee38973f48713c1e7287bcb0b00eff2af35b3672d7eef01a6f67c8d0930654
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 5.0.1 (2022-09-24)
|
6
|
+
|
7
|
+
* Require stdlib `set` for `Inflections`.
|
8
|
+
|
9
|
+
## 5.0.0 (2022-09-24)
|
10
|
+
|
11
|
+
* Drop Ruby 2.4 support.
|
12
|
+
* Drop Ruby 2.5 support.
|
13
|
+
* Drop Ruby 2.6 support.
|
14
|
+
There was the latest patch-version, also `dry-inflector` stopped to support it.
|
15
|
+
* Drop Ruby 2.7 support.
|
16
|
+
There were no handy methods, like `Set#join`. Let's move on.
|
17
|
+
* Add Ruby 3.0 and 3.1 support.
|
18
|
+
|
19
|
+
* Populate default acronyms for `Inflections`.
|
20
|
+
* Fix order of default acronyms in `Inflections`.
|
21
|
+
* Change `Inflections.acronyms` from `Array` to `Set`.
|
22
|
+
* Improve implementation of `Cover`.
|
23
|
+
* Add `Module#deep_dup`.
|
24
|
+
* Fix `Blank` for classes, especially `Sequel::Model.`
|
25
|
+
|
26
|
+
* Update development dependencies.
|
27
|
+
* Resolve new RuboCop offenses.
|
28
|
+
* Update gemspec metadata.
|
29
|
+
* Improve CI.
|
30
|
+
|
31
|
+
## 4.0.0 (2020-06-06)
|
32
|
+
|
33
|
+
* Replace `inflecto` with `dry-inflector` (`.from_dry_inflector`)
|
34
|
+
* Drop unsupported Ruby 2.3 version
|
35
|
+
* Remove `GorillaPatch::Transform` (its methods in stdlib of Ruby >= 2.4)
|
36
|
+
* Improve dependencies versions locks
|
37
|
+
* Improve code style via new RuboCop cops
|
38
|
+
* Write more documentation
|
39
|
+
* Create LICENSE file
|
40
|
+
|
41
|
+
## 3.2.1 (2019-10-08)
|
42
|
+
|
43
|
+
* Fix `CHANGELOG` updating in `rake release` task
|
44
|
+
* Add `FAQ`, `SEO` and `UTM` to default acronyms for `Inflections`
|
45
|
+
|
46
|
+
## 3.2.0 (2019-10-07)
|
47
|
+
|
48
|
+
* Add `Object#blank?`
|
49
|
+
* Add `Module#module_parent_name` and `Module#module_parent`
|
50
|
+
|
51
|
+
## 3.0.1 (2018-07-10)
|
52
|
+
|
53
|
+
* Change `Hash#deep_merge` to do `#deep_dup` for nested objects duplicating
|
54
|
+
|
55
|
+
## 3.0.0 (2018-05-15)
|
56
|
+
|
57
|
+
* Add acronyms for `GorillaPatch::Inflections` (#3)
|
58
|
+
* Rename `gorilla-patch` to `gorilla_patch`
|
59
|
+
* Drop Ruby 2.1 and 2.2 support
|
60
|
+
* Add CHANGELOG (yay!)
|
61
|
+
|
62
|
+
## 2.9.1 (2018-03-26)
|
63
|
+
|
64
|
+
* Fix `GorillaPatch::Blank` for `Range` (or another `Enumerable`) inside Array or Hash
|
65
|
+
|
66
|
+
## 2.9.0 (2018-01-20)
|
67
|
+
|
68
|
+
* Add `nils` option for `Hash#slice*` methods
|
69
|
+
|
70
|
+
## 2.8.0 (2018-01-17)
|
71
|
+
|
72
|
+
* Add `[Array, Hash]#nilify_blank_strings{,!}` in `GorillaPatch::Blank`
|
73
|
+
|
74
|
+
## 2.7.0 (2017-12-26)
|
75
|
+
|
76
|
+
* Add Ruby 2.5 support
|
77
|
+
|
78
|
+
## 2.6.0 (2017-11-11)
|
79
|
+
|
80
|
+
* Add `Delegator#deep_dup` (for `Tempfile` and others) in `GorillaPatch::DeepDup`
|
81
|
+
|
82
|
+
## 2.5.1 (2017-09-08)
|
83
|
+
|
84
|
+
* Return `super` from `Hash#transform_values!` if defined
|
85
|
+
|
86
|
+
## 2.5.0 (2017-09-08)
|
87
|
+
|
88
|
+
* Add `GorillaPatch::Transform` with `Hash#transform_values{,!}`
|
89
|
+
|
90
|
+
## 2.4.3 (2017-09-08)
|
91
|
+
|
92
|
+
* Fix bug (come from `ActiveSupport`) with `Hash#deep_merge!`
|
93
|
+
|
94
|
+
## 2.4.2 (2017-09-08)
|
95
|
+
|
96
|
+
* Revert dynamic defining `GorillaPatch::Namespace` methods for `Module`
|
97
|
+
|
98
|
+
## 2.4.1 (2017-09-08)
|
99
|
+
|
100
|
+
* Fix `GorillaPatch::Namespace` methods for Modules without names (`Module.new` or `Class.new`)
|
101
|
+
|
102
|
+
## 2.4.0 (2017-08-10)
|
103
|
+
|
104
|
+
* Add `[String, Module]#deconstantize` method in `GorillaPatch::Namespace`
|
105
|
+
|
106
|
+
## 2.3.1 (2017-08-10)
|
107
|
+
|
108
|
+
* Fix bug with `Class#demodulize` if class was patched with private method
|
109
|
+
|
110
|
+
## 2.3.0 (2017-07-25)
|
111
|
+
|
112
|
+
* Add `GorillaPatch::DigEmpty` for `Hash#dig` without arguments
|
113
|
+
|
114
|
+
## 2.2.1 (2017-07-23)
|
115
|
+
|
116
|
+
* Add `GorillaPatch::DeepMerge` module with `Hash#deep_merge{,!}` methods
|
117
|
+
|
118
|
+
## 2.1.1 (2017-01-25)
|
119
|
+
|
120
|
+
* Add `NilClass#blank?` method in `GorillaPatch::Blank`
|
121
|
+
|
122
|
+
## 2.1.0 (2017-01-19)
|
123
|
+
|
124
|
+
* Add `GorillaPatch::Truncate` with `String#truncate`
|
125
|
+
|
126
|
+
## 2.0.0 (2017-01-13)
|
127
|
+
|
128
|
+
* Merge `GorillaPatch::LettersCase` and `GorillaPatch::Quantity` into `GorillaPatch::Inflections`
|
129
|
+
* Add `GorillaPatch::Inflections.from_inflecto` (`inflecto-refinements` gem)
|
130
|
+
* Rename `GorillaPatch::Include` to `GorillaPatch::Cover`
|
131
|
+
* Return `Hash` after `Hash#compact!`
|
132
|
+
* Add specs for all modules
|
133
|
+
|
134
|
+
## 1.0.2 (2016-12-29)
|
135
|
+
|
136
|
+
* Fix `String#camelize` method for camelized strings
|
137
|
+
|
138
|
+
## 1.0.1 (2016-11-10)
|
139
|
+
|
140
|
+
* Fix issue with `[Array, Hash]#reject_blank_strings{,!}`
|
141
|
+
|
142
|
+
## 1.0.0 (2016-11-10)
|
143
|
+
|
144
|
+
* Rename `GorillaPatch` modules from "which class refined" to "what it does"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2015 Alexander Popov
|
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/README.md
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
# Gorilla Patch
|
2
|
+
|
3
|
+
[![Cirrus CI - Base Branch Build Status](https://img.shields.io/cirrus/github/AlexWayfer/gorilla_patch?style=flat-square)](https://cirrus-ci.com/github/AlexWayfer/gorilla_patch)
|
4
|
+
[![Codecov branch](https://img.shields.io/codecov/c/github/AlexWayfer/gorilla_patch/main.svg?style=flat-square)](https://codecov.io/gh/AlexWayfer/gorilla_patch)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/maintainability/AlexWayfer/gorilla_patch.svg?style=flat-square)](https://codeclimate.com/github/AlexWayfer/gorilla_patch)
|
6
|
+
[![Depfu](https://img.shields.io/depfu/AlexWayfer/gorilla_patch?style=flat-square)](https://depfu.com/repos/github/AlexWayfer/gorilla_patch)
|
7
|
+
[![Inline docs](https://inch-ci.org/github/AlexWayfer/gorilla_patch.svg?branch=main)](https://inch-ci.org/github/AlexWayfer/gorilla_patch)
|
8
|
+
[![license](https://img.shields.io/github/license/AlexWayfer/gorilla_patch.svg?style=flat-square)](https://github.com/AlexWayfer/gorilla_patch/blob/main/LICENSE.txt)
|
9
|
+
[![Gem](https://img.shields.io/gem/v/gorilla_patch.svg?style=flat-square)](https://rubygems.org/gems/gorilla_patch)
|
10
|
+
|
11
|
+
Ruby Gem for refine Ruby Core classes (like [Monkey patch](https://en.wikipedia.org/wiki/Monkey_patch)).
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ gem install gorilla_patch
|
17
|
+
```
|
18
|
+
|
19
|
+
or with `bundler`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# Gemfile
|
23
|
+
gem 'gorilla_patch'
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'gorilla_patch' # or 'gorilla_patch/keys' for specific functionallity
|
30
|
+
|
31
|
+
hash = { a: 1, b: 2 }
|
32
|
+
|
33
|
+
hash.keys? :a, :b # undefined method!
|
34
|
+
|
35
|
+
module Foo
|
36
|
+
using GorillaPatch::Keys
|
37
|
+
|
38
|
+
hash.keys? :a, :b # true
|
39
|
+
end
|
40
|
+
|
41
|
+
hash.keys? :a, :b # undefined method!
|
42
|
+
```
|
43
|
+
|
44
|
+
### What is `using`?
|
45
|
+
|
46
|
+
[It's standard feature](http://ruby-doc.org/core/doc/syntax/refinements_rdoc.html).
|
47
|
+
|
48
|
+
## Methods
|
49
|
+
|
50
|
+
* **Blank**
|
51
|
+
|
52
|
+
* **`String`**, **`NilClass`**
|
53
|
+
|
54
|
+
* `#blank?`
|
55
|
+
|
56
|
+
* **`Array`**, **`Hash`**
|
57
|
+
|
58
|
+
* `#reject_blank_strings`
|
59
|
+
|
60
|
+
* `#reject_blank_strings!`
|
61
|
+
|
62
|
+
* `#nilify_blank_strings`
|
63
|
+
|
64
|
+
* `#nilify_blank_strings!`
|
65
|
+
|
66
|
+
* **Compact**
|
67
|
+
|
68
|
+
* **`Hash`**
|
69
|
+
|
70
|
+
* `#compact`
|
71
|
+
|
72
|
+
* `#compact!`
|
73
|
+
|
74
|
+
* **DeepDup**
|
75
|
+
|
76
|
+
* **`Object`**, **`Hash`**, **`Array`**, **`Module`**, **`Delegator`**
|
77
|
+
|
78
|
+
* `#deep_dup`
|
79
|
+
|
80
|
+
* **DeepMerge**
|
81
|
+
|
82
|
+
* **`Hash`**
|
83
|
+
|
84
|
+
* `#deep_merge(other_hash, &block)`
|
85
|
+
|
86
|
+
* `#deep_merge!(other_hash, &block)`
|
87
|
+
|
88
|
+
* **DigEmpty**
|
89
|
+
|
90
|
+
* **`Hash`**
|
91
|
+
|
92
|
+
* `#dig()`
|
93
|
+
|
94
|
+
* **Except**
|
95
|
+
|
96
|
+
* **`Hash`**
|
97
|
+
|
98
|
+
* `#except(*)`
|
99
|
+
|
100
|
+
* `#except!(*)`
|
101
|
+
|
102
|
+
* **Inflections**
|
103
|
+
|
104
|
+
* `.acronyms`
|
105
|
+
|
106
|
+
* `.from_sequel`
|
107
|
+
|
108
|
+
* `.from_dry_inflector`
|
109
|
+
|
110
|
+
* **`String`**, **`Module`**
|
111
|
+
|
112
|
+
* `#underscore`
|
113
|
+
|
114
|
+
* **`String`**
|
115
|
+
|
116
|
+
* `#camelize`
|
117
|
+
|
118
|
+
* **Keys**
|
119
|
+
|
120
|
+
* **`Hash`**
|
121
|
+
|
122
|
+
* `#keys?(*)`
|
123
|
+
|
124
|
+
* **ModuleParent**
|
125
|
+
* **`Module`**
|
126
|
+
|
127
|
+
* `#module_parent_name`
|
128
|
+
|
129
|
+
* `#module_parent`
|
130
|
+
|
131
|
+
* **Namespace**
|
132
|
+
* **`String`**, **`Module`**, **`Class`**
|
133
|
+
|
134
|
+
* `#demodulize`
|
135
|
+
|
136
|
+
* `#deconstantize`
|
137
|
+
|
138
|
+
* **Slice**
|
139
|
+
|
140
|
+
* **`Hash`**
|
141
|
+
|
142
|
+
* `#slice(*, nils: false)`
|
143
|
+
|
144
|
+
* `#slice!(*, nils: false)`
|
145
|
+
|
146
|
+
* `#slice_reverse!(*, nils: false)`
|
147
|
+
|
148
|
+
* **Symbolize**
|
149
|
+
|
150
|
+
* **`Hash`**
|
151
|
+
|
152
|
+
* `#symbolize_keys(deep: false)`
|
153
|
+
|
154
|
+
* `#symbolize_keys!(deep: false)`
|
155
|
+
|
156
|
+
* **Truncate**
|
157
|
+
|
158
|
+
* **`String`**
|
159
|
+
|
160
|
+
* `#truncate(position, separator: '', omission: '...')`
|
161
|
+
|
162
|
+
## Testing
|
163
|
+
|
164
|
+
```
|
165
|
+
$ rake spec
|
166
|
+
```
|
167
|
+
|
168
|
+
## Development
|
169
|
+
|
170
|
+
After checking out the repo, run `bundle install` to install dependencies.
|
171
|
+
|
172
|
+
Then, run `toys rspec` to run the tests.
|
173
|
+
|
174
|
+
To install this gem onto your local machine, run `toys gem install`.
|
175
|
+
|
176
|
+
To release a new version, run `toys gem release %version%`.
|
177
|
+
See how it works [here](https://github.com/AlexWayfer/gem_toys#release).
|
178
|
+
|
179
|
+
## Contributing
|
180
|
+
|
181
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/AlexWayfer/gorilla_patch).
|
182
|
+
|
183
|
+
## License
|
184
|
+
|
185
|
+
The gem is available as open source under the terms of the
|
186
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
data/lib/gorilla_patch/blank.rb
CHANGED
@@ -23,6 +23,13 @@ module GorillaPatch
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
## Also affects `Class`, including `Sequel::Model` with `.empty?`
|
27
|
+
refine Module do
|
28
|
+
def blank?
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
26
33
|
# rubocop:disable Metrics/BlockLength
|
27
34
|
REFINED_ENUMERABLES = [Array, Hash].freeze
|
28
35
|
|
@@ -23,6 +23,17 @@ module GorillaPatch
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
refine Module do
|
27
|
+
def deep_dup
|
28
|
+
result = super
|
29
|
+
constants(false).each do |constant|
|
30
|
+
result.send :remove_const, constant
|
31
|
+
result.const_set constant, const_get(constant).deep_dup
|
32
|
+
end
|
33
|
+
result
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
26
37
|
require 'delegate'
|
27
38
|
|
28
39
|
refine Delegator do
|
@@ -28,7 +28,7 @@ module GorillaPatch
|
|
28
28
|
self[other_key] =
|
29
29
|
if self_value.is_a?(Hash) && other_value.is_a?(Hash)
|
30
30
|
self_value.deep_merge!(other_value, &block)
|
31
|
-
elsif
|
31
|
+
elsif block && key?(other_key)
|
32
32
|
yield(other_key, self_value, other_value)
|
33
33
|
else
|
34
34
|
other_value
|
data/lib/gorilla_patch/except.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'set'
|
4
|
+
|
3
5
|
module GorillaPatch
|
4
6
|
## Inflections
|
5
7
|
module Inflections
|
6
8
|
class << self
|
7
9
|
## Set of acronyms which can be modified externally
|
8
10
|
def acronyms
|
9
|
-
@acronyms ||=
|
10
|
-
API DateTime FAQ HTML HTTP HTTPS ID IP JSON SEO SSL UTM XML
|
11
|
-
|
11
|
+
@acronyms ||= Set.new(
|
12
|
+
%w[API CLI DB DateTime FAQ HTML HTTP HTTPS ID IP JSON SEO SSL UTM XML]
|
13
|
+
)
|
12
14
|
end
|
13
15
|
|
14
16
|
## Regular expression for detecting known acronyms
|
@@ -71,8 +73,7 @@ module GorillaPatch
|
|
71
73
|
def define_methods_from_sequel
|
72
74
|
Sequel::Inflections.private_instance_methods.each do |method_name|
|
73
75
|
define_method method_name do
|
74
|
-
Sequel::Inflections.instance_method(method_name)
|
75
|
-
.bind(self).call(self)
|
76
|
+
Sequel::Inflections.instance_method(method_name).bind_call(self, self)
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
@@ -8,7 +8,7 @@ module GorillaPatch
|
|
8
8
|
if defined?(@module_parent_name)
|
9
9
|
@module_parent_name
|
10
10
|
else
|
11
|
-
module_parent_name = name =~ /::[^:]+\Z/ ?
|
11
|
+
module_parent_name = name =~ /::[^:]+\Z/ ? Regexp.last_match.pre_match : nil
|
12
12
|
@module_parent_name = module_parent_name unless frozen?
|
13
13
|
module_parent_name
|
14
14
|
end
|
@@ -8,9 +8,8 @@ module GorillaPatch
|
|
8
8
|
return dup if length <= position
|
9
9
|
|
10
10
|
stop = position - omission.length
|
11
|
-
if separator.is_a?(Regexp) || !separator.empty?
|
12
|
-
|
13
|
-
end
|
11
|
+
stop = rindex(separator, stop) if separator.is_a?(Regexp) || !separator.empty?
|
12
|
+
|
14
13
|
"#{self[0, stop]}#{omission}"
|
15
14
|
end
|
16
15
|
end
|
data/lib/gorilla_patch.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gorilla_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Popov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: pry-byebug
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '3.9'
|
20
20
|
type: :development
|
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: '3.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gem_toys
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: 0.12.1
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 0.12.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: toys
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 0.13.0
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 0.13.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler-audit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.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.9.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rspec
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
89
|
+
version: '3.9'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
96
|
+
version: '3.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.21.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.21.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov-cobertura
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.1'
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: rubocop
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
72
128
|
requirements:
|
73
129
|
- - "~>"
|
74
130
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
131
|
+
version: 1.36.0
|
76
132
|
type: :development
|
77
133
|
prerelease: false
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
79
135
|
requirements:
|
80
136
|
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
138
|
+
version: 1.36.0
|
83
139
|
- !ruby/object:Gem::Dependency
|
84
140
|
name: rubocop-performance
|
85
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,42 +156,42 @@ dependencies:
|
|
100
156
|
requirements:
|
101
157
|
- - "~>"
|
102
158
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
159
|
+
version: '2.0'
|
104
160
|
type: :development
|
105
161
|
prerelease: false
|
106
162
|
version_requirements: !ruby/object:Gem::Requirement
|
107
163
|
requirements:
|
108
164
|
- - "~>"
|
109
165
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
166
|
+
version: '2.0'
|
111
167
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
168
|
+
name: rubocop-sequel
|
113
169
|
requirement: !ruby/object:Gem::Requirement
|
114
170
|
requirements:
|
115
171
|
- - "~>"
|
116
172
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
173
|
+
version: 0.3.1
|
118
174
|
type: :development
|
119
175
|
prerelease: false
|
120
176
|
version_requirements: !ruby/object:Gem::Requirement
|
121
177
|
requirements:
|
122
178
|
- - "~>"
|
123
179
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
180
|
+
version: 0.3.1
|
125
181
|
- !ruby/object:Gem::Dependency
|
126
182
|
name: dry-inflector
|
127
183
|
requirement: !ruby/object:Gem::Requirement
|
128
184
|
requirements:
|
129
185
|
- - "~>"
|
130
186
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
187
|
+
version: 0.3.0
|
132
188
|
type: :development
|
133
189
|
prerelease: false
|
134
190
|
version_requirements: !ruby/object:Gem::Requirement
|
135
191
|
requirements:
|
136
192
|
- - "~>"
|
137
193
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
194
|
+
version: 0.3.0
|
139
195
|
- !ruby/object:Gem::Dependency
|
140
196
|
name: sequel
|
141
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,10 +212,11 @@ executables: []
|
|
156
212
|
extensions: []
|
157
213
|
extra_rdoc_files: []
|
158
214
|
files:
|
215
|
+
- CHANGELOG.md
|
216
|
+
- LICENSE.txt
|
217
|
+
- README.md
|
159
218
|
- lib/gorilla_patch.rb
|
160
219
|
- lib/gorilla_patch/blank.rb
|
161
|
-
- lib/gorilla_patch/compact.rb
|
162
|
-
- lib/gorilla_patch/cover.rb
|
163
220
|
- lib/gorilla_patch/deep_dup.rb
|
164
221
|
- lib/gorilla_patch/deep_merge.rb
|
165
222
|
- lib/gorilla_patch/dig_empty.rb
|
@@ -175,7 +232,14 @@ files:
|
|
175
232
|
homepage: https://github.com/AlexWayfer/gorilla_patch
|
176
233
|
licenses:
|
177
234
|
- MIT
|
178
|
-
metadata:
|
235
|
+
metadata:
|
236
|
+
bug_tracker_uri: https://github.com/AlexWayfer/gorilla_patch/issues
|
237
|
+
changelog_uri: https://github.com/AlexWayfer/gorilla_patch/blob/v5.0.1/CHANGELOG.md
|
238
|
+
documentation_uri: http://www.rubydoc.info/gems/gorilla_patch/5.0.1
|
239
|
+
homepage_uri: https://github.com/AlexWayfer/gorilla_patch
|
240
|
+
rubygems_mfa_required: 'true'
|
241
|
+
source_code_uri: https://github.com/AlexWayfer/gorilla_patch
|
242
|
+
wiki_uri: https://github.com/AlexWayfer/gorilla_patch/wiki
|
179
243
|
post_install_message:
|
180
244
|
rdoc_options: []
|
181
245
|
require_paths:
|
@@ -184,14 +248,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
248
|
requirements:
|
185
249
|
- - ">="
|
186
250
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
251
|
+
version: '3.0'
|
252
|
+
- - "<"
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '4'
|
188
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
256
|
requirements:
|
190
257
|
- - ">="
|
191
258
|
- !ruby/object:Gem::Version
|
192
259
|
version: '0'
|
193
260
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
261
|
+
rubygems_version: 3.3.7
|
195
262
|
signing_key:
|
196
263
|
specification_version: 4
|
197
264
|
summary: Refining core classes
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GorillaPatch
|
4
|
-
## Adding compact methods
|
5
|
-
module Compact
|
6
|
-
refine Hash do
|
7
|
-
def compact
|
8
|
-
select { |_key, value| !value.nil? }
|
9
|
-
end
|
10
|
-
|
11
|
-
def compact!
|
12
|
-
delete_if { |_key, value| value.nil? }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/gorilla_patch/cover.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module GorillaPatch
|
4
|
-
## Adding include methods
|
5
|
-
module Cover
|
6
|
-
refine Range do
|
7
|
-
def cover?(value)
|
8
|
-
return super unless value.is_a?(Range) && RUBY_VERSION < '2.6'
|
9
|
-
|
10
|
-
super(value.first) && super(value.last)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|