defunkt / tomdoc

A TomDoc Ruby library.
http://tomdoc.org/
MIT License
114 stars 16 forks source link

Handle empty TomDoc comment as an empty string #27

Closed miyagawa closed 11 years ago

miyagawa commented 11 years ago

When you call .tomdoc on a method without any TomDoc documentation, the method will throw errors:

NoMethodError: undefined method `sub' for nil:NilClass
   .../tomdoc/lib/tomdoc/tomdoc.rb:130:in `tomdoc'

You can work around by calling .valid? before calling it, but other method such as raw works fine, and the error message isn't useful anyway.

This patch fixes it by simply returning '' for comment.tomdoc in case of no comments.