Ruby - RDoc :nodoc: Modifier

Introduction

RDoc supports a number of modifiers within comments, along with command-line options.

P:To make RDoc ignore something in this way, simply follow the module, class, or method definition with a comment of :nodoc:, like so:

# This is a class that does nothing 
class MyClass 
  # This method is documented 
  def some_method 
  end 

  def secret_method #:nodoc: 
  end 
end 

RDoc will ignore secret_method.

:nodoc: only operates directly upon the elements upon which it is placed.

To apply to the current element and all those beneath it (all methods within a class), do this:

# This is a class that does nothing 
class MyClass #:nodoc: all 
  # This method is documented (or is it?) 
  def some_method 
  end 

  def secret_method 
  end 
end 

Now none of MyClass is documented by RDoc.

Related Topic