3

I am using Ruby on Rails 3.1.0 and I am trying to use YARD 0.7.4. I would like to document constant values, so in my class I state this:

# [Fixnum] Test constant documentation.
TEST_CONSTANT = 1

but the HTML output after I run the yardoc (or yard doc) command is the following:

enter image description here

In the above image is shown that the HTML documentation is not good rendered/generated, at least not as I would expect. I read the YAML documentation but I still have some problem on that: how can I better state and display documentation related to constant values?

user12882
  • 4,702
  • 9
  • 39
  • 54

1 Answers1

5

I also ran into this problem and google returned me this unanswered post. I found the answer by Loren Segal (creator of Yard) in another forum: link_to_forum. For completeness reasons I add this for people that run into the same problem:

You document it the same way you document any other object. Just put comments above the constant.

# Documentation here
TEST_CONSTANT = 1   

Note though that at least for me the resulting formatting looks a bit strange. It first formats the name of the constant, then shows the description and then the values. I would expect first the description, followed by the name and values.

Axe
  • 672
  • 6
  • 19