rdoc command ships with Ruby and by default generates all .rb files in or below the current directory.  
rdoc lib to just include your project’s main Ruby code.
rake rdoc.
Once generated, you can view the generated output at doc/index.html.
The RDocTask will create the following targets:
:rdoc Main task for this RDOC task. :clobber_rdoc Delete all the rdoc files. This target is automatically added to the main clobber target. :rerdoc Rebuild the rdoc files from scratch, even if they are not out of date.
Simple Example:
  require 'rdoc/task'
  Rake::RDocTask.new do |rd|
    rd.main = "README.rdoc"
    rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
  end
You may wish to give the task a different name, such as if you are
generating two sets of documentation. 
For instance, if you want to have a development set of documentation including private methods:
  require 'rdoc/task'
  Rake::RDocTask.new(:rdoc_dev) do |rd|
    rd.main = "README.doc"
    rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
    rd.options << "--all"
  end
The tasks would then be named :rdoc_dev, :clobber_rdoc_dev, and :rerdoc_dev.
[~/srcLPPruby/rdoc(master)]$ rake -T rake clobber_rdoc # Remove RDoc HTML files rake rdoc # Build RDoc HTML files rake rerdoc # Rebuild RDoc HTML files
Casiano Rodriguez León 2015-01-07