使用Rdoc生成ruby说明文档

几点说明

"-":代表缩进的符号列表
"[]":代表描述列表,方括号内的是被描述的对象,比如这里是cat,跟着的是描述说明,描述说明将换行缩进显示
"<em></em>":表示文本为斜体
"<b></b>":表示文本为粗体
"-- ++":之间的文本不会被解析,也就是在api文档中看不到这段文本
"http:":文本为超链接
"::":冒号

代码

class Demo
  # - 测试
  # [cat] a kind of animal
  # [+dog+] also a pet
  # = leval one
  # - == leval two
  # and so on
  # ----
  # how about this
  # - http:www.baidu.com
  def foo(name)
    @name = name
  end


  # Extract the age and calculate the
  # date-of-birth.
  #--
  # FIXME: fails if the birthday falls on
  # February 29th
  #++
  # The DOB is returned as a Time object.

  def get_dob(person)

  end
end

效果


使用Rdoc生成ruby说明文档_第1张图片

class Demo

Public Instance Methods

foo(name)
  • 测试

cat

a kind of animal

dog

also a pet

leval one

  • leval two

and so on

how about this

  • www.baidu.com




get_dob
(person)

Extract the age and calculate the date-of-birth. The DOB is returned as aTime object.




英文文档介绍, http://rdoc.sourceforge.net/doc/index.html

你可能感兴趣的:(使用Rdoc生成ruby说明文档)