Method: YARD::Docstring#create_tag
- Defined in:
- lib/yard/docstring.rb
#create_tag(tag_name, tag_buf) ⇒ Tags::Tag, Tags::RefTag
Creates a tag from the tag factory.
To add an already created tag object, use #add_tag
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/yard/docstring.rb', line 163 def create_tag(tag_name, tag_buf) if tag_buf =~ /\A\s*(?:(\S+)\s+)?\(\s*see\s+(\S+)\s*\)\s*\Z/ return create_ref_tag(tag_name, $1, $2) end tag_factory = Tags::Library.instance tag_method = "#{tag_name}_tag" if tag_name && tag_factory.respond_to?(tag_method) add_tag(*[tag_factory.send(tag_method, tag_buf)].flatten) else log.warn "Unknown tag @#{tag_name}" + (object ? " in file `#{object.file}` near line #{object.line}" : "") end rescue Tags::TagFormatError log.warn "Invalid tag format for @#{tag_name}" + (object ? " in file `#{object.file}` near line #{object.line}" : "") end |