except_nested 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce8d61447e18525bc6d98dae31ffe737eb4d8882
4
- data.tar.gz: fbceed209c89579f5ab75a507920a947b796018d
3
+ metadata.gz: b17ef1eb5a2532ffb4a7da058b5493f6595fb497
4
+ data.tar.gz: e8ae309967e1afa31518fb4ba3dd1a2f6d64ebf2
5
5
  SHA512:
6
- metadata.gz: bd6da6fecdf470ff9eb8bb0e28346b5cae692121d6e594cbb60a8c3411fa9537c4ec36bd62f2f099142f6052a8f161c6db281b88d29669999079ba29c12d320b
7
- data.tar.gz: 7033a86553ebc7698351cab2bd198b67c8fe47dddb632545ecf24cea0680bb58c61f38025a4d86e5883e99966a7b50cbf642c948a13cbe170e9b19f851daab1a
6
+ metadata.gz: d31a60ec88b8f5f983d348e02d02d31c0f2e13b3a17f1d62e9d04a5bf8fba27620871dca9162f266302de21c8d4e042e201479a91647cf375ba00d7234d7872f
7
+ data.tar.gz: 8ff851e99d8231c20f1a9062b198a04e7946f3e6444c988ecd604b1ad49d34af1737a8bb807be756bfdccfc49255dd4efbf8432a69885ce06331616756e6c380
data/.gitignore CHANGED
@@ -1,12 +1,36 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
1
+ # Created by https://www.gitignore.io/api/ruby
2
+
3
+ ### Ruby ###
4
+ *.gem
5
+ *.rbc
6
+ /.config
5
7
  /coverage/
6
- /doc/
8
+ /InstalledFiles
7
9
  /pkg/
8
10
  /spec/reports/
11
+ /spec/examples.txt
12
+ /test/tmp/
13
+ /test/version_tmp/
9
14
  /tmp/
10
15
 
11
- # rspec failure tracking
12
- .rspec_status
16
+ # Used by dotenv library to load environment variables.
17
+ # .env
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalization:
26
+ /.bundle/
27
+ /vendor/bundle
28
+ /lib/bundler/man/
29
+
30
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
31
+ .rvmrc
32
+
33
+ # End of https://www.gitignore.io/api/ruby
34
+
35
+ # Ignore publish script due to credentials
36
+ .publish
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ except_nested (0.1.1)
5
+ activesupport (~> 4.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.9)
11
+ i18n (~> 0.7)
12
+ minitest (~> 5.1)
13
+ thread_safe (~> 0.3, >= 0.3.4)
14
+ tzinfo (~> 1.1)
15
+ codeclimate-test-reporter (0.4.8)
16
+ simplecov (>= 0.7.1, < 1.0.0)
17
+ diff-lcs (1.3)
18
+ docile (1.1.5)
19
+ i18n (0.8.6)
20
+ json (2.1.0)
21
+ minitest (5.10.3)
22
+ rake (10.5.0)
23
+ rspec (3.6.0)
24
+ rspec-core (~> 3.6.0)
25
+ rspec-expectations (~> 3.6.0)
26
+ rspec-mocks (~> 3.6.0)
27
+ rspec-core (3.6.0)
28
+ rspec-support (~> 3.6.0)
29
+ rspec-expectations (3.6.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.6.0)
32
+ rspec-mocks (3.6.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.6.0)
35
+ rspec-support (3.6.0)
36
+ simplecov (0.15.0)
37
+ docile (~> 1.1.0)
38
+ json (>= 1.8, < 3)
39
+ simplecov-html (~> 0.10.0)
40
+ simplecov-html (0.10.2)
41
+ thread_safe (0.3.6)
42
+ tzinfo (1.2.3)
43
+ thread_safe (~> 0.1)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ bundler (~> 1.15)
50
+ codeclimate-test-reporter (~> 0.4.8)
51
+ except_nested!
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+ simplecov (~> 0.15.0)
55
+
56
+ BUNDLED WITH
57
+ 1.15.3
data/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  [![Build Status](https://travis-ci.org/abarrak/except_nested.svg?branch=master)](https://travis-ci.org/abarrak/except_nested)
4
4
  [![Dependency Status](https://gemnasium.com/badges/github.com/abarrak/except_nested.svg)](https://gemnasium.com/github.com/abarrak/except_nested)
5
5
 
6
- **except_nested** allows exclusion of given hash keys at varies depth of the hash.
6
+ **except_nested** allows exclusion of given hash keys at various depth of the hash.
7
7
 
8
- It's an extended version of active_support `#except` hash utility
8
+ It's an extended version of active_support `#except` hash utility.
9
9
 
10
10
  ## Installation
11
11
 
@@ -28,10 +28,47 @@ $ gem install except_nested
28
28
  ```
29
29
 
30
30
  ## Usage
31
- TODO ...
31
+ Given the following hash:
32
+
33
+ ```ruby
34
+ h = { name: 'Zohoor', degree: 'Psychology', preferences: { color: 'mauve', drink: 'coffee', pet: 'cat' } }
35
+ ```
36
+ You can deep except keys:
37
+
38
+ ```ruby
39
+ h.except_nested(:degree, preferences: [:color, :pet])
40
+ => { name: "Zohoor", preferences: { drink: "coffee" } }
41
+
42
+ h.except_nested(preferences: :pet)
43
+ => { name: "Zohoor", degree: "Psychology", preferences: { color: "mauve", drink: "coffee" } }
44
+
45
+ h.except_nested(preferences: [:pet], :name)
46
+ => { degree: "Psychology", preferences: { color: "mauve", drink: "coffee" } }
47
+
48
+ h.except_nested(:degree, preferences: [:color, :pet, :drink])
49
+ => { name: "Zohoor" }
50
+
51
+ # original hash is preserved ..
52
+ h
53
+ => { name: "Zohoor", degree: "Psychology", preferences: {color: "mauve", drink: "coffee", pet: "cat"}}
54
+ ```
55
+
56
+ Or exclude keys at first level just like normal `#except` does:
57
+
58
+ ```ruby
59
+ h.except_nested(:name)
60
+ => { degree: "Psychology", preferences: { color: "mauve", drink: "coffee", pet: "cat" } }
61
+
62
+ h.except_nested(:name, :degree)
63
+ => { preferences: { color: "mauve", drink: "coffee", pet: "cat" } }
64
+
65
+ h.except_nested(:name, :degree, :preferences)
66
+ => {}
67
+ ```
32
68
 
33
69
  ## Documentation
34
- TODO ...
70
+
71
+ [RDoc version](http://www.rubydoc.info/gems/except_nested) at RubyDoc.
35
72
 
36
73
  ## Development
37
74
 
@@ -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 exclusion of given hash keys at varies depth."
16
+ spec.description = "except_nested allows exclusion of given hash keys at various depth."
17
17
  spec.homepage = "https://github.com/abarrak/except_nested"
18
18
  spec.license = "MIT"
19
19
 
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "bundler", "~> 1.15"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
- spec.add_development_dependency "simplecov", "~> 0.12.0"
31
+ spec.add_development_dependency "simplecov", "~> 0.15.0"
32
32
  spec.add_development_dependency "codeclimate-test-reporter", "~> 0.4.8"
33
33
  end
@@ -17,8 +17,8 @@ class Hash
17
17
 
18
18
  # Removes the given nested keys from hash and returns it.
19
19
  # hash = { a: true, b: { x: true, y: false }, c: nil }
20
- # hash.except_nested(b: [:y]) # => { a: true, b: { x: true }, c: nil }
21
- # hash # => { a: true, b: false }
20
+ # hash.except_nested!(b: [:y]) # => { a: true, b: { x: true }, c: nil }
21
+ # hash # => { a: true, b: { x: true }, c: nil }
22
22
  def except_nested!(*nested_keys)
23
23
  nested_keys.each do |key|
24
24
  if key.is_a?(Hash)
@@ -1,3 +1,3 @@
1
1
  module ExceptNested
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdullah Barrak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.12.0
75
+ version: 0.15.0
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.12.0
82
+ version: 0.15.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: codeclimate-test-reporter
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.4.8
97
- description: except_nested allows exclusion of given hash keys at varies depth.
97
+ description: except_nested allows exclusion of given hash keys at various depth.
98
98
  email:
99
99
  - abdullah@abarrak.com
100
100
  executables: []
@@ -107,6 +107,7 @@ files:
107
107
  - ".ruby-version"
108
108
  - ".travis.yml"
109
109
  - Gemfile
110
+ - Gemfile.lock
110
111
  - LICENSE.txt
111
112
  - README.md
112
113
  - Rakefile