ruby-immutable-struct 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby-immutable-struct.rb +9 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6117ec164f5eeac76e57b32e4e12be46877f004d
4
- data.tar.gz: e68c11492ed3363bb5bd99fcd14034ffa9ee09db
3
+ metadata.gz: 7754c81e29ded23e8bd3cf9564802c0ad78009a2
4
+ data.tar.gz: c4959dcf1b820d28faac4b143791b441787dca7f
5
5
  SHA512:
6
- metadata.gz: 12188b71d8b39e0e89fe55187b879da790de2d7d9039560871167c6e606ce3b93f6abd2b76375b0029a29a97a20aa5d1a56ba15f5a05d21e01c163cd85080cd4
7
- data.tar.gz: 3c7a8cf0c2b2f022fa7204cd25215b85054ac5b0ead6012a5a658b173bf122f8e19195bdd34fef7e43413125a52453966e30c4256a913aa47f2a7e607133b98e
6
+ metadata.gz: 21ec58ffd29d618e6a4f82f9a402606648eeb53b8a2870362237182c4363cb7c1d02d3e8a857a947835ec649046bf774396f92ba3e8fa8dfe84c35147b1bdeae
7
+ data.tar.gz: 6d70901b359203958f8a85c26f4948bf0535ca2de69a17045cdd86fa880bbda7fdb13baacfb354846782c0399256d098366e376371e2a35438f8f93404f63a7c
@@ -40,6 +40,15 @@ module RubyImmutableStruct
40
40
  [ #{attributes.map{ |a| "@#{a}" }.join(',')} ]
41
41
  end
42
42
 
43
+ def ==(other)
44
+ #{attributes.map{ |a| "@#{a} == other.#{a}" }.join(' && ')}
45
+ end
46
+ alias :eql? :==
47
+
48
+ def hash
49
+ to_a.hash
50
+ end
51
+
43
52
  def inspect
44
53
  "#<#\{self.class.name} #\{to_a.map(&:inspect).join(',')}>"
45
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-immutable-struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Hooper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-01 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: adam@adamhooper.com