resource-struct 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: f9513a73bc3c6331f8174bd02c30c72fcbc655fb2e00c8d88cb1cd80fa3c60ae
4
- data.tar.gz: 3d1355e235d443b74098434f453a482d090790a25f57c65ce8a57f931813863a
3
+ metadata.gz: 3435cd92f2c4374cfd84a3411fd5a9d42fdd80f3e9ef1a13b847d302ba3fd313
4
+ data.tar.gz: 79ffe2f000b766de16130742bfd1a087222bf2d6c9ebf70dc9b328f2cdeb3394
5
5
  SHA512:
6
- metadata.gz: 88f21e99bce0cf3620cf0644f240176af22bd64f99a51781c293cd407467062cbe784d50274115e4214443801f34d10c79858a27910e9bf54556356e5e95d753
7
- data.tar.gz: bfa0b4576f987a5a5a7d39d62abcc7ac4f00fd6f2d27c8bb20d124fbf092914bab0212c8c4987451a86d47e3c06d31ab3452c777f0f25cb29a128e6ca048e3cf
6
+ metadata.gz: 6c74aece00d81f98c1cd6bc7b42cd4d6fdf43a60493cd247bc30f949e844cc048b28853c33f73acc18bc3a2fa6ad70bbe9438ec3a7ab56086cc5f73ca0db3de7
7
+ data.tar.gz: 413595f3fc61327671dc6c499477f7208bd8d6095e7b429e276c5b9082b4dc670bab7b40424f7ef4d4bb2a7cc8850e40809010258c007916cab0cb6141e6566b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.1] - 2022-01-01
4
+ ### Fix
5
+ - Correct handling of #== operator on Structs with hashes
6
+
3
7
  ## [0.2.0] - 2022-01-01
4
8
  ### Changed
5
9
  - Indifferent access support for input hash (support for symbol-based hashes in initializer)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- resource-struct (0.2.0)
4
+ resource-struct (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "resource/struct"
5
+ require "resource-struct"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -105,12 +105,16 @@ module ResourceStruct
105
105
  def ___all_keys_equal(other)
106
106
  return false unless @hash.count == other.count
107
107
 
108
- @hash.reduce(true) do |acc, (k, v)|
108
+ @hash.reduce(true) do |acc, (k, _)|
109
+ value = self[k]
109
110
  if other.key?(k)
110
- acc && other[k] == v
111
+ acc && value == other[k]
112
+ elsif k.is_a?(String)
113
+ ck = k.to_sym
114
+ acc && other.key?(ck) && value == other[ck]
111
115
  else
112
116
  ck = ___convert_key(k)
113
- acc && other.key?(ck) && other[ck] == v
117
+ acc && other.key?(ck) && value == other[ck]
114
118
  end
115
119
  end
116
120
  end
@@ -102,12 +102,16 @@ module ResourceStruct
102
102
  def ___all_keys_equal(other)
103
103
  return false unless @hash.count == other.count
104
104
 
105
- @hash.reduce(true) do |acc, (k, v)|
105
+ @hash.reduce(true) do |acc, (k, _)|
106
+ value = self[k]
106
107
  if other.key?(k)
107
- acc && other[k] == v
108
+ acc && value == other[k]
109
+ elsif k.is_a?(String)
110
+ ck = k.to_sym
111
+ acc && other.key?(ck) && value == other[ck]
108
112
  else
109
113
  ck = ___convert_key(k)
110
- acc && other.key?(ck) && other[ck] == v
114
+ acc && other.key?(ck) && value == other[ck]
111
115
  end
112
116
  end
113
117
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ResourceStruct
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resource-struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Riedler