rubyrdoc

How to show constant value in rdoc?


Is it possible to have rdoc also show value of constant, not just it's comment? At the moment it's generating

Constants

DEFAULT_CONFIG_FILE

    Default configuration file location

what I would like to get is

Constants

DEFAULT_CONFIG_FILE = '~/config.yaml'

    Default configuration file location

given source code

DEFAULT_CONFIG_FILE = '~/config.yaml'

How can I achieve that?


Solution

  • You have to create a custom template.

    Here is the offending line in the template that only shows the name. You'll have to add a reference to const.value.

    Maybe something as simple as:

    <dt id="<%= const.name %>"><%= const.name %> = <%= const.value %>