nice_hash 1.16.3 → 1.17.0

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
  SHA256:
3
- metadata.gz: 5937a8d8101c07c797a59ab099b79f2b34402f8a225ec3fb171b258e395ed69c
4
- data.tar.gz: 942f8d0f81e5098837ce027c0797f86f15de4981d5945ce7ce6ec3d1539c97b6
3
+ metadata.gz: 8319335fc75dd3ea181a84bdc8a67adf979b42e2fde45b4b2c1686927b877886
4
+ data.tar.gz: f0ca1147eb97015392f846a8449dac01c4df5f223336fc69aa7c83b8dd5dbc01
5
5
  SHA512:
6
- metadata.gz: '087841b5fc615183cb45eb9634bda722937da1292094cb833fca58d002337c84c6c18b8920a4f8b829c71eff9465fbe1606d3104ede3ee235285acb31e05536b'
7
- data.tar.gz: 4e7f680d02059ecf90dee8ce828538f51af3f8dcbb454df447e187899af95647a0302ddf2437c3b72adf62b4214ef05e744b813560cf228fc2962b2c00d1b7dd
6
+ metadata.gz: ac548edf37ae74f11a21368c8b5f02d061b33a6fe2749f39f88cb10371e93701fe0ce53e548cf7c67ac968e2fced504fa709716597c0e498e26db0bc29863ee4
7
+ data.tar.gz: 7fe62a823ffe2b59048225847d83d684792c0097801d72707f4a74e89f138c6a7d61b6181a919964671463754ac7ac990646a8cb3d01f9a2aaaff3317bf8d9ae
data/README.md CHANGED
@@ -900,6 +900,17 @@ value.is_a?(Boolean) #> true
900
900
  text.is_a?(Boolean) #> false
901
901
 
902
902
  ```
903
+
904
+ #### in?(array)
905
+ Added method in? to all objects that accepts array as a parameter.
906
+
907
+ ```ruby
908
+ 'uno'.in?(['uno','dos']) #> true
909
+ :uno.in? [:uno, :dos] #> true
910
+ 5.in? [1,2,3,4,6] #> false
911
+
912
+ ```
913
+
903
914
  ### Other tools integration
904
915
 
905
916
  #### Tabulo
@@ -292,12 +292,12 @@ class Hash
292
292
  alias patterns pattern_fields
293
293
  end
294
294
 
295
- ###########################################################################
296
- # symbolize hash of arrays and array of hashes
297
- # Taken from gist https://gist.github.com/Integralist/9503099
298
- # Thanks to @integralist
299
- ###########################################################################
300
295
  class Object
296
+ ###########################################################################
297
+ # symbolize hash of arrays and array of hashes
298
+ # Taken from gist https://gist.github.com/Integralist/9503099
299
+ # Thanks to @integralist
300
+ ###########################################################################
301
301
  def deep_symbolize_keys
302
302
  if is_a? Hash
303
303
  return reduce({}) do |memo, (k, v)|
@@ -312,6 +312,14 @@ class Object
312
312
  end
313
313
  self
314
314
  end
315
+
316
+ ###########################################################################
317
+ # include? but the opposite. Check if the object is included on the array
318
+ ###########################################################################
319
+ def in?(array)
320
+ array.include?(self)
321
+ end
322
+
315
323
  end
316
324
 
317
325
  class Array
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nice_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.3
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string_pattern
@@ -36,20 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 3.8.0
39
+ version: 3.9.0
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '3.8'
42
+ version: '3.9'
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 3.8.0
49
+ version: 3.9.0
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '3.8'
52
+ version: '3.9'
53
53
  description: 'NiceHash creates hashes following certain patterns so your testing will
54
54
  be much easier. Parse and filter JSON. You can easily generate all the hashes you
55
55
  want following the criteria you specify. Many other features coming to Hash class