attr_extras 2.2.0 → 2.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
  SHA1:
3
- metadata.gz: d34aacc5f3feb712ffe95b8bf2a52aa72062beb4
4
- data.tar.gz: 1fac1c2c1dd6039bb6f6a0846b74bb80989bcfa6
3
+ metadata.gz: 1a73dba01ae15a21f182bf0f75ba144f53894ad3
4
+ data.tar.gz: 04674763cf6c41bf2ae1e6209ff74c317a8b645d
5
5
  SHA512:
6
- metadata.gz: bd82d64a1cb6f42556a659e03dd8160ada1b64cccbce889ece550bfbf8afb63f5aad6e7b1d848f3de70d3f753f9148859f4a33ade5ceba0f0531fcc76e11b445
7
- data.tar.gz: eef168267a504e30f5740c54c7b54dcfc476dab70a372cc3d3e3fd5889dbf5e88316782d19a95345571430412adb0a89d47e26b844ed0c7cfcd5813fdc18710a
6
+ metadata.gz: 584bd69b6af78936a1d33c000690357356b71c18d7f7203faa1834a83e9373a29f9c2729c962c415c2bb662aa3a0852cc9133fe61b4fc816a3e1072d7a9c8507
7
+ data.tar.gz: 23b28d7605848caae757fa3c8bcc88200a24e531a58034b30ba08eee71da6238f3c4a1362dd01ffd5bee8e4a9f1c3d3f9144a4286fdcd540e56c5ba380de7047
data/lib/attr_extras.rb CHANGED
@@ -28,7 +28,7 @@ module AttrExtras
28
28
  alias_method :eql?, :==
29
29
 
30
30
  define_method(:hash) do
31
- [self.class.name, *names.map { |attr| public_send(attr) }].hash
31
+ [self.class, *names.map { |attr| public_send(attr) }].hash
32
32
  end
33
33
  end
34
34
 
@@ -1,3 +1,3 @@
1
1
  module AttrExtras
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
@@ -219,22 +219,30 @@ describe Object, ".attr_value" do
219
219
  attr_initialize :foo
220
220
  attr_value :foo
221
221
  end
222
+ klass2 = Class.new do
223
+ attr_initialize :foo
224
+ attr_value :foo
225
+ end
222
226
 
223
227
  example1 = klass.new("Foo")
224
228
  example2 = klass.new("Foo")
225
229
  example3 = klass.new("Bar")
230
+ example4 = klass2.new("Foo")
226
231
 
227
232
  example1.hash.must_equal example2.hash
228
233
  example1.hash.wont_equal example3.hash
234
+ example1.hash.wont_equal example4.hash
229
235
 
230
236
  assert example1.eql?(example2), "Examples should be 'eql?'"
231
- refute example2.eql?(example3), "Examples should not be 'eql?'"
237
+ refute example1.eql?(example3), "Examples should not be 'eql?'"
238
+ refute example1.eql?(example4), "Examples should not be 'eql?'"
232
239
 
233
- Set[example1, example2, example3].length.must_equal 2
240
+ Set[example1, example2, example3, example4].length.must_equal 3
234
241
 
235
242
  hash = {}
236
243
  hash[example1] = :awyeah
237
244
  hash[example3] = :wat
245
+ hash[example4] = :nooooo
238
246
  hash[example2].must_equal :awyeah
239
247
  end
240
248
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh