You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aliasing an existing method prior to wrapping makes YARD wrongly report the new name as an alternative name to the wrapper -- instead of to the wrapped.
Minimal example:
class Array
alias original_size size
def size # prints the "effective" size
self.compact.original_size
end
end
The following is an extract of what YARD generates for the above:
Instance Method Details
- (Object) size
Also known as: original_size
the last statement of which is simply wrong: #size and #original_size are different methods. The correct statement should go along the lines
Instance Method Details
- (Object) size
Note: this is a redefinition, the method originally named size was aliased as original_size.
YARD behaviour seems to result from not taking position into account, i.e., disregarding the place in the code where the alias ocurred. If the alias command was placed after the method definition, YARD report would be right (although the method logic would be wrong and a SystemStackError would be raised if the method were ever called).
The text was updated successfully, but these errors were encountered:
Effectively, any method declaration (def ...) should just wipe any alias info for that method. I'm not sure the note is of much use, or perhaps that's information that can be added later.
Aliasing an existing method prior to wrapping makes YARD wrongly report the new name as an alternative name to the wrapper -- instead of to the wrapped.
Minimal example:
class Array
alias original_size size
def size # prints the "effective" size
self.compact.original_size
end
end
The following is an extract of what YARD generates for the above:
the last statement of which is simply wrong: #size and #original_size are different methods. The correct statement should go along the lines
YARD behaviour seems to result from not taking position into account, i.e., disregarding the place in the code where the alias ocurred. If the alias command was placed after the method definition, YARD report would be right (although the method logic would be wrong and a SystemStackError would be raised if the method were ever called).
The text was updated successfully, but these errors were encountered: