Skip to content

Conversation

@k-duho
Copy link
Contributor

@k-duho k-duho commented Dec 17, 2025

Summary

Fix NoMethodError: undefined method 'to_yard' when using YARD or RDoc format options.

Closes #212

Problem

When running annotaterb models --format-yard on a model with indexes, foreign keys, or check constraints:

NoMethodError: undefined method 'to_yard' for an instance of
AnnotateRb::ModelAnnotator::IndexAnnotation::Annotation

Solution

Added to_yard and to_rdoc methods to:

  • IndexAnnotation::Annotation
  • ForeignKeyAnnotation::Annotation
  • CheckConstraintAnnotation::Annotation

Related

Test

  • Added unit tests for to_yard and to_rdoc in all three annotation specs

Fix NoMethodError when using YARD or RDoc format with indexes,
foreign keys, or check constraints.

The following Annotation classes were missing to_yard and to_rdoc
methods that are called in annotation_builder.rb:
- IndexAnnotation::Annotation
- ForeignKeyAnnotation::Annotation
- CheckConstraintAnnotation::Annotation

Also adds unit tests for the new methods.

Fixes drwl#212
@k-duho k-duho mentioned this pull request Dec 22, 2025
Copy link
Owner

@drwl drwl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this

@drwl drwl merged commit 9c0a93c into drwl:main Jan 2, 2026
22 checks passed
@drwl drwl mentioned this pull request Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yard format broken?

2 participants