rdoc icon indicating copy to clipboard operation
rdoc copied to clipboard

[Documentation] Could the main README.md link to examples, and could one example show how to obtain the information that we obtain from the commandline, into a String?

Open rubyFeedback opened this issue 5 years ago • 0 comments

Hello rdoc-maintainers,

I am creating a "pseudo" shell in ruby; actually it is embedded into a gtk-widget, and that part works fine on windows too (WSL + xming).

One part of that shell shall display documentation from ruby. rdoc is the logical choice here.

Unfortunately, obtaining the string from a method-lookup in rdoc is a bit difficult; I can use rdoc driver to display it but I am not sure how to easily capture it (and I don't want to mess with stdout and StringIO anymore either, it just leads to more complicated code IMO).

A simple API would be nice that could be used, something like:

.result?
.string?

Ideally it should reside in one of the toplevel methods, perhaps not necessarily on Rdoc. directly, but the rdoc-driver, or some other place (I have no preference here).

Would it then be possible to also add documentation showing how to easily obtain the string? Once I have that string, I have to modify it a bit before I can then either display it on the commandline (in this case I don't even need any modification) or display it in the gtk-widget (in which case I have to sanitize it, e. g. make sure no faulty characters are included, no ASCII colour escape codes and so forth, which is why I need to obtain the String).

I tried to go through the source code, but I have to admit that the ruby style in use here is really really absolutely not what I am familiar with. It makes reading that code really hard for me.

PS: I could have asked this on SO perhaps but SO is a bit inactive in regards to ruby, and ideally we would have great documentation so that this could be found (and exists) within a given ruby project. I suppose rdoc is quite old now, almost 20 years or so?

rubyFeedback avatar Sep 05 '20 15:09 rubyFeedback