lib/modern/struct.rb in modern-0.4.6 vs lib/modern/struct.rb in modern-0.5.0

- old
+ new

@@ -16,10 +16,12 @@ def copy(fields = {}) self.class[self.class.attribute_names.map { |n| [n, self[n]] }.to_h.merge(fields)] end end - constructor_type :strict_with_defaults + transform_types do |type| + type.constructor { |value| value.nil? ? Undefined : value } + end include Copy end end