We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79001cf commit 5ea3f40Copy full SHA for 5ea3f40
lib/value_semantics/instance_methods.rb
@@ -33,16 +33,15 @@ def initialize(attributes = nil)
33
invalid_attrs = nil
34
35
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
+ if remaining_attrs.delete(attr.name)
+ value = attributes_hash.fetch(attr.name)
+ elsif attr.optional?
+ value = attr.default_generator.()
+ else
+ missing_attrs ||= []
+ missing_attrs << attr.name
+ next
+ end
46
47
coerced_value = attr.coerce(value, self.class)
48
if attr.validate?(coerced_value)
0 commit comments