lib/sober_swag/serializer/meta.rb in sober_swag-0.14.0 vs lib/sober_swag/serializer/meta.rb in sober_swag-0.15.0
- old
+ new
@@ -32,10 +32,12 @@
@base.finalize_lazy_type!
# Using .meta on dry-struct returns a *new type* that wraps the old one.
# As such, we need to be a bit clever about when we tack on the identifier
# for this type.
%i[lazy_type type].each do |sym|
- public_send(sym).identifier(@base.public_send(sym).identifier) if @base.public_send(sym).respond_to?(:identifier)
+ if @base.public_send(sym).respond_to?(:identifier) && public_send(sym).respond_to?(:identifier)
+ public_send(sym).identifier(@base.public_send(sym).identifier)
+ end
end
end
def lazy_type?
@base.lazy_type?