Class: YARD::Readme::TagFactory
- Inherits:
-
Object
- Object
- YARD::Readme::TagFactory
- Defined in:
- lib/yard/readme/tag_factory.rb
Overview
Custom tag factory that overrides the default YARD tag factory to provide special handling for @readme tags. Specifically, it ensures that blank or empty @readme tags are properly processed.
Instance Method Summary collapse
-
#blank_readme_tag?(tag_name, text) ⇒ Boolean
Checks if a tag is a blank @readme tag (no content).
-
#parse_tag_with_title_and_text(tag_name, text) ⇒ YARD::Tags::Tag
Overrides the default tag parsing behavior to handle blank @readme tags.
Instance Method Details
#blank_readme_tag?(tag_name, text) ⇒ Boolean
Checks if a tag is a blank @readme tag (no content). This helper method is used to determine whether special handling is needed for a given tag.
37 38 39 |
# File 'lib/yard/readme/tag_factory.rb', line 37 def blank_readme_tag?(tag_name, text) tag_name == "readme" && text.nil? || text.empty? end |
#parse_tag_with_title_and_text(tag_name, text) ⇒ YARD::Tags::Tag
Overrides the default tag parsing behavior to handle blank @readme tags.
This method ensures that @readme tags without any text are properly handled, rather than being processed by the default YARD parser which expects title and text for tags defined with :with_title_and_text.
22 23 24 25 26 |
# File 'lib/yard/readme/tag_factory.rb', line 22 def parse_tag_with_title_and_text(tag_name, text) return YARD::Tags::Tag.new(tag_name, text) if blank_readme_tag?(tag_name, text) super end |