What does <tt> mean in Ruby comments?

Passing on the source code written in Ruby, for example Rails, I often see that the small code is wrapped with a tt tag, as in rails / activesupport / core_ext / array / access.rb

  # Equal to <tt>self[2]</tt>. # # %w( abcde).third # => "c" def third self[2] end 

What is the agreement, when and why was it decided to use these designations?

+6
source share
2 answers

Yes my mistake sorry

This is part of the special RDoc system.

 Non-verbatim text can be marked up: italic: word or <em>text</em> bold: word or <b>text</b> typewriter: word or <tt>text</tt> 

Read more about it here.

+4
source

Found it myself in the Rails Documentation Guide .

Using the +...+ pair for a fixed-width font only works with words; that is: everything that matches \A\w+\z . For anything else, use <tt>...</tt> , in particular characters, setters, inline snippets, etc .:

0
source

All Articles