nice_hash 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -12
- data/lib/nice/hash/add_to_ruby.rb +0 -22
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebd488acd42bb66424fca139b54c4b84c3e4a99d58212e3a6fb902538dcdbd80
|
4
|
+
data.tar.gz: 9376521974d65b79c906e473873e43a65b6805c4b3a86a100feeeeb223c9ac54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d820527f00a6d3820005035aa49f26c0fa39d6ac5aa01180b14addb9635ccfcbb84bef70f0a7ca5d02949bfdd275a5b7c1f1ffdd2ec30cde31a442fb4187972
|
7
|
+
data.tar.gz: f9e357422beff603f0065aa6626034f42fd0445309a489027e28a8d76824be1609ca43dd949bae00b94e86fe8d4c892695d760624416a50176421a9c3945d53d
|
data/README.md
CHANGED
@@ -168,18 +168,6 @@ puts new_hash.get_values(:address, :zip) #> {:zip=>{:default=>"00000", :correct=
|
|
168
168
|
puts new_hash.get_values(:drawId) #> {:drawId=>["84914", "21158"]}
|
169
169
|
```
|
170
170
|
|
171
|
-
In case of an array of hashes, you will be able also to access the different keys, for example:
|
172
|
-
|
173
|
-
```ruby
|
174
|
-
my_array = [{name: 'Peter', city: 'Madrid'}, {name: 'Lola', city: 'NYC'}] :
|
175
|
-
|
176
|
-
my_array.city
|
177
|
-
#> ['Madrid', 'NYC']
|
178
|
-
|
179
|
-
my_array._name
|
180
|
-
#> ['Peter', 'Lola']
|
181
|
-
```
|
182
|
-
|
183
171
|
### Change all values on the keys we specified
|
184
172
|
|
185
173
|
Supply a hash with all the keys and the values you want to change on the hash, then it will return the hash/array with the values modified at any level.
|
@@ -280,25 +280,3 @@ class Object
|
|
280
280
|
self
|
281
281
|
end
|
282
282
|
end
|
283
|
-
|
284
|
-
class Array
|
285
|
-
###########################################################################
|
286
|
-
# For Array of Hashes returns an array of values of the hash key specified in case doesn't exist an Array method with the same name
|
287
|
-
# The keys can be accessed also adding underscore to avoid problems with existent methods
|
288
|
-
# examples for the array of hashes [{name: 'Peter', city: 'Madrid'}, {name: 'Lola', city: 'NYC'}] :
|
289
|
-
# my_array.city
|
290
|
-
# my_array._name
|
291
|
-
###########################################################################
|
292
|
-
def method_missing(m, *arguments, &block)
|
293
|
-
m = m[1..-1].to_sym if m[0] == "_"
|
294
|
-
array = []
|
295
|
-
self.map do |hash|
|
296
|
-
if hash.is_a?(Hash)
|
297
|
-
array << hash[m]
|
298
|
-
else
|
299
|
-
array << nil
|
300
|
-
end
|
301
|
-
end
|
302
|
-
array
|
303
|
-
end
|
304
|
-
end
|