Closed neilvcarvalho closed 9 months ago
While debugging code backed by StoreModel, I had issues understanding some model attributes, as those that were more complex objects just printed the attribute's class and its memory address.
StoreModel
I saw something like:
=> #<Content::Text type: text, text: #<Content::Text::Base:0x000000011a9716f0>>
By contrast, the default Ruby inspect implementation calls inspect on all the object's instance variables:
inspect
=> #<OuterClass:0x0000000104ac87f8 @attribute=#<InnerClass:0x000000010466cf60 @text="string">>
Also, the strings are not quoted, making strings like "nil" and "false" show up as nil and false, which may lead to confusion.
"nil"
"false"
nil
false
This commit changes the inspect implementation to call inspect on the model attributes, fixing the issues stated above.
While debugging code backed by
StoreModel
, I had issues understanding some model attributes, as those that were more complex objects just printed the attribute's class and its memory address.I saw something like:
By contrast, the default Ruby
inspect
implementation callsinspect
on all the object's instance variables:Also, the strings are not quoted, making strings like
"nil"
and"false"
show up asnil
andfalse
, which may lead to confusion.This commit changes the
inspect
implementation to callinspect
on the model attributes, fixing the issues stated above.