lib/dry/struct/class_interface.rb in dry-struct-0.1.1 vs lib/dry/struct/class_interface.rb in dry-struct-0.2.0
- old
+ new
@@ -49,11 +49,11 @@
self
end
def check_schema_duplication(new_schema)
- shared_keys = new_schema.keys & schema.keys
+ shared_keys = new_schema.keys & (schema.keys - superclass.schema.keys)
raise RepeatedAttributeError, shared_keys.first if shared_keys.any?
end
private :check_schema_duplication
@@ -65,10 +65,10 @@
end
end
def schema
super_schema = superclass.respond_to?(:schema) ? superclass.schema : {}
- super_schema.merge(@schema || {})
+ super_schema.merge(@schema)
end
def new(attributes = default_attributes)
if attributes.instance_of?(self)
attributes