except_nested 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +31 -32
- data/README.md +3 -3
- data/except_nested.gemspec +4 -4
- data/lib/except_nested/core_ext/hash/except_nested.rb +2 -2
- data/lib/except_nested/version.rb +1 -1
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a3ed17b1f9fd0540a8fcdd320449ce45eb02857
|
4
|
+
data.tar.gz: 9f3e0695414fa73c6fadad1dbf32770cd6ac468f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95de5a62325aa59c87208c801c8827961e0529e7a73003331f40fea311f2da54b9212123192a15c992ab589020784d6540a35141fd6dcd98489c8ce9873d487a
|
7
|
+
data.tar.gz: b39c5e69db13f7daf39a3337100f3917da39d94dd9349beb533f3ea1e83c9f469e7222982ac6cdf38274c5acdcec98baebec7159b66b4ac9522f4474174c5fc9
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,58 +1,57 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
except_nested (0.1.
|
4
|
+
except_nested (0.1.3)
|
5
5
|
activesupport (~> 5)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (5.
|
10
|
+
activesupport (5.2.6)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
-
i18n (
|
12
|
+
i18n (>= 0.7, < 2)
|
13
13
|
minitest (~> 5.1)
|
14
14
|
tzinfo (~> 1.1)
|
15
15
|
codeclimate-test-reporter (0.4.8)
|
16
16
|
simplecov (>= 0.7.1, < 1.0.0)
|
17
|
-
concurrent-ruby (1.
|
18
|
-
diff-lcs (1.
|
19
|
-
docile (1.
|
20
|
-
i18n (
|
21
|
-
|
22
|
-
minitest (5.
|
23
|
-
rake (
|
24
|
-
rspec (3.
|
25
|
-
rspec-core (~> 3.
|
26
|
-
rspec-expectations (~> 3.
|
27
|
-
rspec-mocks (~> 3.
|
28
|
-
rspec-core (3.
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-expectations (3.
|
17
|
+
concurrent-ruby (1.1.9)
|
18
|
+
diff-lcs (1.4.4)
|
19
|
+
docile (1.3.5)
|
20
|
+
i18n (1.8.10)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
minitest (5.14.4)
|
23
|
+
rake (13.0.6)
|
24
|
+
rspec (3.10.0)
|
25
|
+
rspec-core (~> 3.10.0)
|
26
|
+
rspec-expectations (~> 3.10.0)
|
27
|
+
rspec-mocks (~> 3.10.0)
|
28
|
+
rspec-core (3.10.1)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-expectations (3.10.1)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-mocks (3.10.2)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-support (3.
|
37
|
-
simplecov (0.
|
38
|
-
docile (~> 1.1
|
39
|
-
|
40
|
-
|
41
|
-
simplecov-html (0.10.2)
|
35
|
+
rspec-support (~> 3.10.0)
|
36
|
+
rspec-support (3.10.2)
|
37
|
+
simplecov (0.18.5)
|
38
|
+
docile (~> 1.1)
|
39
|
+
simplecov-html (~> 0.11)
|
40
|
+
simplecov-html (0.12.3)
|
42
41
|
thread_safe (0.3.6)
|
43
|
-
tzinfo (1.2.
|
42
|
+
tzinfo (1.2.9)
|
44
43
|
thread_safe (~> 0.1)
|
45
44
|
|
46
45
|
PLATFORMS
|
47
|
-
|
46
|
+
x86_64-darwin-15
|
48
47
|
|
49
48
|
DEPENDENCIES
|
50
|
-
bundler (
|
49
|
+
bundler (>= 2.2.20)
|
51
50
|
codeclimate-test-reporter (~> 0.4.8)
|
52
51
|
except_nested!
|
53
|
-
rake (~>
|
52
|
+
rake (~> 13.0)
|
54
53
|
rspec (~> 3.0)
|
55
|
-
simplecov (~> 0.
|
54
|
+
simplecov (~> 0.17)
|
56
55
|
|
57
56
|
BUNDLED WITH
|
58
|
-
|
57
|
+
2.2.20
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/except_nested.svg)](https://rubygems.org/gems/except_nested)
|
3
3
|
[![Build Status](https://travis-ci.org/abarrak/except_nested.svg?branch=master)](https://travis-ci.org/abarrak/except_nested)
|
4
4
|
[![Test Coverage](https://codeclimate.com/github/abarrak/except_nested/badges/coverage.svg)](https://codeclimate.com/github/abarrak/except_nested/coverage)
|
5
|
-
[![Dependency Status](https://gemnasium.com/badges/github.com/abarrak/except_nested.svg)](https://gemnasium.com/github.com/abarrak/except_nested)
|
6
5
|
|
7
6
|
**except_nested** allows exclusion of given hash keys at various depth of the hash.
|
8
7
|
|
@@ -34,6 +33,7 @@ Given the following hash:
|
|
34
33
|
```ruby
|
35
34
|
h = { name: 'Zohoor', degree: 'Psychology', preferences: { color: 'mauve', drink: 'coffee', pet: 'cat' } }
|
36
35
|
```
|
36
|
+
|
37
37
|
You can deep except keys:
|
38
38
|
|
39
39
|
```ruby
|
@@ -51,10 +51,10 @@ h.except_nested(:degree, preferences: [:color, :pet, :drink])
|
|
51
51
|
|
52
52
|
# original hash is preserved ..
|
53
53
|
h
|
54
|
-
=> { name: "Zohoor", degree: "Psychology", preferences: {color: "mauve", drink: "coffee", pet: "cat"}}
|
54
|
+
=> { name: "Zohoor", degree: "Psychology", preferences: { color: "mauve", drink: "coffee", pet: "cat" } }
|
55
55
|
```
|
56
56
|
|
57
|
-
Or exclude keys
|
57
|
+
Or exclude keys in the first level just like normal `#except` does:
|
58
58
|
|
59
59
|
```ruby
|
60
60
|
h.except_nested(:name)
|
data/except_nested.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.email = ["abdullah@abarrak.com"]
|
14
14
|
|
15
15
|
spec.summary = "An extended version of active_support #except hash utility."
|
16
|
-
spec.description = "except_nested allows
|
16
|
+
spec.description = "except_nested allows extraction of given hash values at various depth of the hash."
|
17
17
|
spec.homepage = "https://github.com/abarrak/except_nested"
|
18
18
|
spec.license = "MIT"
|
19
19
|
|
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '~> 5'
|
28
|
-
spec.add_development_dependency "bundler", "
|
29
|
-
spec.add_development_dependency "rake", "~>
|
28
|
+
spec.add_development_dependency "bundler", ">= 2.2.20"
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
spec.add_development_dependency "simplecov", "~> 0.
|
31
|
+
spec.add_development_dependency "simplecov", "~> 0.17"
|
32
32
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4.8"
|
33
33
|
end
|
@@ -24,7 +24,7 @@ class Hash
|
|
24
24
|
if key.is_a?(Hash)
|
25
25
|
key.each do |sub_key, sub_value|
|
26
26
|
if sub_value.is_a?(Array)
|
27
|
-
self[sub_key].delete_if { |k,
|
27
|
+
self[sub_key].delete_if { |k, _| sub_value.include?(k) }
|
28
28
|
delete(sub_key) if self[sub_key].empty?
|
29
29
|
elsif sub_value.is_a?(Hash)
|
30
30
|
self[sub_key].except_nested!(sub_value)
|
@@ -33,7 +33,7 @@ class Hash
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
elsif key.is_a?(Array)
|
36
|
-
delete_if { |k,
|
36
|
+
delete_if { |k, _| k == key.first }
|
37
37
|
else
|
38
38
|
delete(key)
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: except_nested
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdullah Barrak
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -28,30 +28,30 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.2.20
|
34
34
|
type: :development
|
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: 2.2.20
|
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'
|
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'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: '0.17'
|
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
|
-
version: 0.
|
82
|
+
version: '0.17'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: codeclimate-test-reporter
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +94,8 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.4.8
|
97
|
-
description: except_nested allows
|
97
|
+
description: except_nested allows extraction of given hash values at various depth
|
98
|
+
of the hash.
|
98
99
|
email:
|
99
100
|
- abdullah@abarrak.com
|
100
101
|
executables: []
|
@@ -121,7 +122,7 @@ homepage: https://github.com/abarrak/except_nested
|
|
121
122
|
licenses:
|
122
123
|
- MIT
|
123
124
|
metadata: {}
|
124
|
-
post_install_message:
|
125
|
+
post_install_message:
|
125
126
|
rdoc_options: []
|
126
127
|
require_paths:
|
127
128
|
- lib
|
@@ -136,9 +137,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
137
|
- !ruby/object:Gem::Version
|
137
138
|
version: '0'
|
138
139
|
requirements: []
|
139
|
-
rubyforge_project:
|
140
|
+
rubyforge_project:
|
140
141
|
rubygems_version: 2.6.12
|
141
|
-
signing_key:
|
142
|
+
signing_key:
|
142
143
|
specification_version: 4
|
143
144
|
summary: 'An extended version of active_support #except hash utility.'
|
144
145
|
test_files: []
|