nice_hash 1.9.0 → 1.9.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 +2 -0
- data/lib/nice_hash.rb +3 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 249b566696d5318f1d0c705386ab26fc6361a343da30b82a5a877d55e9c580de
|
4
|
+
data.tar.gz: a13077bb28217ed4869e14a4d2369029409fef58cdaeb582d7762ff030f7cbf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d757b6dfac4d65498fe47d5ea46b2a4a04ae65b9f3ef82c788a9722d588444bf582db7ff467290e19d187f810282f843568d1d4245656973e96489d9548dcd67
|
7
|
+
data.tar.gz: 1fac5fa164636d5d4a8019fd82305845c64facfdc5b3d0b02945d19231374aabcebea058ef4e8281d48df558158dee36540e580180e927ce971532b8755a8356
|
data/README.md
CHANGED
@@ -623,6 +623,8 @@ This is a possible output of the previous code:
|
|
623
623
|
By using the NiceHash.compare_structure method you can analyze the supplied replica and verify that the structure follows the one supplied on structure. It supports nested combination of arrays and hashes. It will return true if the comparison is successful.
|
624
624
|
|
625
625
|
```ruby
|
626
|
+
require 'nice_hash'
|
627
|
+
|
626
628
|
my_structure = [
|
627
629
|
{ name: 'xxx',
|
628
630
|
zip: 'yyyy',
|
data/lib/nice_hash.rb
CHANGED
@@ -741,18 +741,9 @@ class NiceHash
|
|
741
741
|
end
|
742
742
|
end
|
743
743
|
elsif structure.is_a?(Array)
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
return false unless compare_structure(structure[0], elem, compare_only_if_exist_key)
|
748
|
-
end
|
749
|
-
else
|
750
|
-
# compare every element on structure with replica
|
751
|
-
i = 0
|
752
|
-
structure.each do |elem|
|
753
|
-
return false unless compare_structure(elem, replica[i], compare_only_if_exist_key)
|
754
|
-
i += 1
|
755
|
-
end
|
744
|
+
# compare all elements of replica with the structure of the first element on structure
|
745
|
+
replica.each do |elem|
|
746
|
+
return false unless compare_structure(structure[0], elem, compare_only_if_exist_key)
|
756
747
|
end
|
757
748
|
end
|
758
749
|
return true
|
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.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string_pattern
|