Closed pointlessone closed 2 months ago
This is by design and working as intended, although your expectation may differ. YARD's view source is intended to peek inside implementations, not necessarily act as a source browser. As such, occasionally YARD provides synthetic implementations for certain (well-known) metaprogrammed constructs. In this case, the source code generated by attr_reader is indeed def whatever; @whatever; end
. In this case, "source code" is a bit of an overloaded term since there exists two sets of source: that defined by the user, and any source eval'd / generated by the program. YARD tends to favor the latter, as it provides a more accurate view into the actual code / documentation.
There's no real intention to change this behavior unless there's a strong argument against displaying the (also correct) machine generated code. Marking this as closed since it's not in scope for YARD.
Attribute documentation provides fictional code.
Steps to reproduce
Here's how an attribute is defined in the source file.
Actual Output
In the generated documentation source code for this attribute is this:
Expected Output
I'd expect the source code to be extracted directly from the source file.
Environment details:
ruby -v
): 3.0.0p0yard -v
): 0.9.34I have read the Contributing Guide.