ruby-immutable-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 +4 -4
- data/lib/ruby-immutable-struct.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6117ec164f5eeac76e57b32e4e12be46877f004d
|
4
|
+
data.tar.gz: e68c11492ed3363bb5bd99fcd14034ffa9ee09db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12188b71d8b39e0e89fe55187b879da790de2d7d9039560871167c6e606ce3b93f6abd2b76375b0029a29a97a20aa5d1a56ba15f5a05d21e01c163cd85080cd4
|
7
|
+
data.tar.gz: 3c7a8cf0c2b2f022fa7204cd25215b85054ac5b0ead6012a5a658b173bf122f8e19195bdd34fef7e43413125a52453966e30c4256a913aa47f2a7e607133b98e
|
@@ -18,9 +18,15 @@ module RubyImmutableStruct
|
|
18
18
|
#{attributes.map.with_index{ |a, i| "@#{a} = args[#{i}]" }.join(';')}
|
19
19
|
end
|
20
20
|
|
21
|
+
after_initialize
|
22
|
+
|
21
23
|
freeze
|
22
24
|
end
|
23
25
|
|
26
|
+
def after_initialize
|
27
|
+
# Implementations may override this
|
28
|
+
end
|
29
|
+
|
24
30
|
def merge(hash)
|
25
31
|
merged_hash = to_h.merge!(hash)
|
26
32
|
self.class.new(merged_hash)
|