lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

rb_define_global_const not documented? #915

Closed thomthom closed 8 years ago

thomthom commented 8 years ago

Global constants defined in .rb files appear to be documented:

# This is a test.
HELLO_RUBY = 'Hi!'.freeze

That will appear under "Top Level Namespace".

But defining a global constant in C doesn't seem to document:

// Hello C World.
rb_define_global_const("SOME_NAME", Qtrue);

That doesn't appear anywhere in the docs - even though the constant regex appear to take into account the pattern for this function.

Is this intentional somehow or a bug? If it's intentional, how can a plugin add constants to the Top Level Namespace?

lsegal commented 8 years ago

It looks like it's not supported. handler_methods.rb has the following guard:

return unless type == 'const'

I wouldn't be opposed to a patch that added support for these constants. This shouldn't be a plugin, if you're going to implement this, please open a PR.

thomthom commented 8 years ago

Cool. I'll look into that.

thomthom commented 8 years ago

@lsegal - do you have a setup for using a Ruby debugger to step trough the code when YARD runs?