method_struct 0.1.0 → 0.1.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: fd51f5aba65faaa0c6cb612239de739383ad873e
4
- data.tar.gz: b527ef867dccbbfebf2987b6dbfaa3a7690fde24
3
+ metadata.gz: c812de26bc02d8f041a9c15e2ff91538acc2fc18
4
+ data.tar.gz: 5104e3c88e016e420b4569d365355624159716b7
5
5
  SHA512:
6
- metadata.gz: 24aaef918e536af629c2e6dfb6a429557fcb4e9c12a41c3758f4a3be20fd12988c104e16d4247c833a5f523afe0752a28b33c0c33ed9d3dce80f5f57b5fd9a52
7
- data.tar.gz: 9f9c06625c1a5c9e3cd2b8af0f210223e93a1789e3fdcf37a633a90ceaad06f12d25d3c1ec0a129cdca67bc651862437597b932ea8b7b30ab6f293e300d79097
6
+ metadata.gz: 85d17a5dad6436da9f2036fb4382bd998a7a9910d6c37dac5705a710af9bbc251dc0aaffa5f8843dc955ca222383ac1512c8643c2c39962afa93b59a7de3c14b
7
+ data.tar.gz: 0fe8d4fa04a9edaf7191b00c42c95ee92c0c100abdfbd0575a3121456b6a0ef94a921bbb82dfb57c1f268afddbaea7a312cac474ec0fdf2628247a819b7a9b76
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 0.1.1
2
+ + Implement #eql? in terms of #==
3
+
1
4
  0.1.0
2
5
 
3
6
  ~ #== an #hash are now overloaded in MethodStructs so that two MethodStructs
data/lib/method_struct.rb CHANGED
@@ -35,6 +35,7 @@ module MethodStruct
35
35
  send(field) == other.send(field)
36
36
  end
37
37
  end
38
+ alias_method :eql?, :==
38
39
 
39
40
  define_method(:hash) do
40
41
  fields.map { |field| send(field).hash }.inject(&:^)
@@ -1,3 +1,3 @@
1
1
  module MethodStruct
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -48,6 +48,10 @@ describe MethodStruct do
48
48
  expect(struct.new(argument1, argument2) == struct.new(argument1, argument2)).to be_true
49
49
  end
50
50
 
51
+ it "is eql for equal arguments" do
52
+ expect(struct.new(argument1, argument2).eql?(struct.new(argument1, argument2))).to be_true
53
+ end
54
+
51
55
  it "has equal hashes for equal arguments" do
52
56
  expect(struct.new(1, 2).hash).to eq(struct.new(1, 2).hash)
53
57
  end
@@ -56,6 +60,10 @@ describe MethodStruct do
56
60
  expect(struct.new(argument1, argument2) == struct.new(argument2, argument1)).to be_false
57
61
  end
58
62
 
63
+ it "is uneql for unequal arguments" do
64
+ expect(struct.new(argument1, argument2).eql?(struct.new(argument2, argument1))).to be_false
65
+ end
66
+
59
67
  it "is unequal for different MethodsStruct classes" do
60
68
  expect(MethodStruct.new(:a, :b).new(1, 2)).not_to eq(struct.new(1, 2))
61
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Obrok
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler