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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/lib/nice_hash.rb +3 -12
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a6794b7445afc2d92574c62a5d3828dea4466b75d01798e3696c9b4b9d7600f
4
- data.tar.gz: 355f72c6905723c0661f8e35bf5bfb2b7a72d7af86412204be79dc6a61edf58e
3
+ metadata.gz: 249b566696d5318f1d0c705386ab26fc6361a343da30b82a5a877d55e9c580de
4
+ data.tar.gz: a13077bb28217ed4869e14a4d2369029409fef58cdaeb582d7762ff030f7cbf3
5
5
  SHA512:
6
- metadata.gz: 0117c9c08fdbeade95163ee9e4b996f5d8fc79c3f26065ce91a541498a7064c33941af1b915e13ac4659915d93971ea23a0bf53fba4e277be6e908377a5f3e9f
7
- data.tar.gz: d9bb73186497690eba76d112b9351a5690ed3295ed79925ace8ccc599a2f8e02973a32342be033028bde4167425a493cf5267ad4ebc44cdd8b28ae7a8c662e05
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
- if structure.size == 1
745
- # compare all elements of replica with the structure of the only element on structure
746
- replica.each do |elem|
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.0
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-07 00:00:00.000000000 Z
11
+ date: 2019-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string_pattern