Documenting Source Code in RubyMine
Basics
RubyMine provides convenient features for creating documentation comments.
Documentation comments in your source code are available for the Quick Documentation Lookup and open for review on pressing Ctrl+Q.
Documentation comments can be created in accordance with the RDoc or YARD syntax.
When you create additional tags, RubyMine provides code completion that suggests the possible tag names.
RDoc support
RDoc tags are completed:
RDoc highlighting in documentation comments can be enabled or disabled. To enable it, select the check box Highlight RDoc and ruby syntax in comments in the Appearance page of the editor settings.
YARD support
YARD tags are completed:
- YARD directives complete in places where methods could be defined;
- Type annotations complete where applicable (assignments, before block vars);
param/return/etc.
tags complete before methods, inside directive docstrings, beforeattr_reader/writer/accessor
HEREDOC support
Besides documentation comments in the RDoc and YARD formats, RubyMine supports HEREDOCS. This is especially useful, if you are writing large blocks of text.
For example, consider the following:
If you perform run, the lines between <<-HEREDOC and HEREDOC appear in the Run tool window.