class ReadmeYard::CommentTag

@readme

```@readme comment``` - Embeds the comment.

Public Class Methods

format_docstring_as_comment(yard_object) click to toggle source

@see rubydoc.info/gems/yard/YARD%2FDocstring:to_raw

# File lib/readme_yard/comment_tag.rb, line 22
def format_docstring_as_comment(yard_object)
  comment = +""
  docstring = yard_object.docstring.all
  docstring.gsub!(named_readme_tag_regex, "")
  docstring.lines.each do |line|
    comment << "#"
    comment << " " unless line[0] == "\n"
    comment << line
  end
  last_line = yard_object.docstring.all.lines.last
  comment << "#" if last_line.match?(/\n$/)
  comment
end
format_tag_markdown(yard_object, _tag) click to toggle source

This comment is in the README because `@readme comment` is below, in the source code.

@readme comment

# File lib/readme_yard/comment_tag.rb, line 14
def format_tag_markdown(yard_object, _tag)
  comment = format_docstring_as_comment(yard_object)
  ExampleTag.format_ruby(comment)
end
named_readme_tag_regex() click to toggle source
# File lib/readme_yard/comment_tag.rb, line 36
def named_readme_tag_regex
  @named_readme_tag_regex ||= /(\n|^)@readme\s(#{YARDReadme::DocstringParser.readme_tag_names.join("|")})\n/
end