Skip to content

Commit 5ea3f40

Browse files
committed
Fix syntax error on older Rubies
2.7 is fine with `next` in an assignment, but all older versions don't like it.
1 parent 79001cf commit 5ea3f40

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/value_semantics/instance_methods.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,15 @@ def initialize(attributes = nil)
3333
invalid_attrs = nil
3434

3535
self.class.value_semantics.attributes.each do |attr|
36-
value =
37-
if remaining_attrs.delete(attr.name)
38-
attributes_hash.fetch(attr.name)
39-
elsif attr.optional?
40-
attr.default_generator.()
41-
else
42-
missing_attrs ||= []
43-
missing_attrs << attr.name
44-
next
45-
end
36+
if remaining_attrs.delete(attr.name)
37+
value = attributes_hash.fetch(attr.name)
38+
elsif attr.optional?
39+
value = attr.default_generator.()
40+
else
41+
missing_attrs ||= []
42+
missing_attrs << attr.name
43+
next
44+
end
4645

4746
coerced_value = attr.coerce(value, self.class)
4847
if attr.validate?(coerced_value)

0 commit comments

Comments
 (0)