immutable-struct 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immutable-struct.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ef4c872306eeb408eaaee1d514de56f0917cbb5ab32a721279feb6e4ed1971
|
4
|
+
data.tar.gz: 5c1afb5b32cb4edf20ec71ad760927ac376c582826eb4a96d276860cf4710efa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4c5c9f24d9650b8c42bd57d9266973540ffce2990aae6b7407e95a3fd2dc9e533d943fe4eaf357c40dc9bb2c1598bd59d054571a0a42de0a70bc9b791e0ac03
|
7
|
+
data.tar.gz: 8512b6b471c543b5379224ca029c529ee0550f889d27b0986e3bc26e6ea45ec03932cc1d41bc2178e288d53baafdcc1e1e8f7a732e5cd6c035c59863c408b0ea
|
data/lib/immutable-struct.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# will be evaluated as if it were inside a class definition, allowing you
|
7
7
|
# to add methods, include or extend modules, or do whatever else you want.
|
8
8
|
class ImmutableStruct
|
9
|
-
VERSION='2.4.
|
9
|
+
VERSION='2.4.1' #:nodoc:
|
10
10
|
# Create a new class with the given read-only attributes.
|
11
11
|
#
|
12
12
|
# attributes:: list of symbols or strings that can be used to create attributes.
|
@@ -72,7 +72,7 @@ class ImmutableStruct
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
|
75
|
+
def self.from(value)
|
76
76
|
case value
|
77
77
|
when self then value
|
78
78
|
when Hash then new(value)
|
@@ -105,9 +105,9 @@ class ImmutableStruct
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
|
108
|
+
def merge(new_attrs)
|
109
109
|
attrs = to_h
|
110
|
-
|
110
|
+
self.class.new(attrs.merge(new_attrs))
|
111
111
|
end
|
112
112
|
|
113
113
|
alias_method :eql?, :==
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immutable-struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stitch Fix Engineering
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-04-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|