super_diff icon indicating copy to clipboard operation
super_diff copied to clipboard

Consider a `Module` to be displayed similar to a `Class`, as a "primitive"

Open phorsuedzie opened this issue 8 months ago • 0 comments

SuperDiff version: 0.12.1 (newest release available)

An inspected Module is not displayed with its name, but with its instance variables etc. (by ...::InstanceTreeBuilders::DefaultObject).

This is different from a Class, which is a SuperDiff.primitive?, and therefore displayed by ...::InstanceTreeBuilders::Primitive, with (only) its name.

The ugly output can be seen at an RSpec example description (rspec --format doc ...) that is auto-generated from a be_a matcher:

it { is_expected.to(be_a(TaskJob)) }

is shown as

is expected to be a kind of #<Module:0x00000001183d33f8 @_dependencies=[], @_included_block=#<Proc:0x000000011941db78>>

If (only) either SuperDiff.primitive? or Primitive.applies_to? is patched to (additionally) return true for a Module === value, then the output looks better:

is expected to be a kind of TaskJob

phorsuedzie avatar Jun 24 '24 15:06 phorsuedzie