I've written a few tests which demonstrate some unexpected (to me) behavior when including another Class's attribute_set. I'll refer to classes which include Virtus as Entities and to classes which include Virtus::ValueObject as Values.
N.B. I may well be abusing the fact that an AttributeSet is a module, and would appreciate a gentle course-correction if that is the case :grin:
What I've found is that it looks like it's possible to grab an attribute set from an Entity, include it in either a Value or another Entity, and build "on top" of the included attribute set. However, it is only half-possible to grab an attribute set from a Value and do the same. I say "half-possible" since the included attribute set's reader methods are included, but I am unable to set those attributes through the constructor.
If that's not comprehensible, the linked tests express it in code. The first test and the last test are the failure cases.
What's most puzzling to me is that this behavior seems to depend on the AttributeSet and not the class into which it is included.
I've written a few tests which demonstrate some unexpected (to me) behavior when including another Class's
attribute_set
. I'll refer to classes which includeVirtus
as Entities and to classes which includeVirtus::ValueObject
as Values.N.B. I may well be abusing the fact that an
AttributeSet
is a module, and would appreciate a gentle course-correction if that is the case :grin:What I've found is that it looks like it's possible to grab an attribute set from an Entity, include it in either a Value or another Entity, and build "on top" of the included attribute set. However, it is only half-possible to grab an attribute set from a Value and do the same. I say "half-possible" since the included attribute set's reader methods are included, but I am unable to set those attributes through the constructor.
If that's not comprehensible, the linked tests express it in code. The first test and the last test are the failure cases.
What's most puzzling to me is that this behavior seems to depend on the
AttributeSet
and not the class into which it is included.