RDoc: bug or limitation?

V

Vincent Foley

I think I found a bug in RDoc, although this could be a limitation, I'm
not sure. Here's the code:

@@valid_services = [:rubyurl, :tinyurl, :shorl, :snipurl, :metamark,
:makeashorterlink, :skinnylink]
private_method_class:)get_short_url, *@@valid_services)

However, when I generate the doc, only ShortURL.get_short_url is makred
as a private class method, ShortURL.rubyurl and everything are marked
as public class methods.

Vincent.
 
G

Gennady Bystritsky

RDoc parses ruby code in pretty simplified way, not execute it. Hence a
lot of limitations, your case being one of them (I think).

Gennady.
 
L

Lothar Scholz

Hello Vincent,

VF> I think I found a bug in RDoc, although this could be a limitation, I'm
VF> not sure. Here's the code:

VF> @@valid_services = [:rubyurl, :tinyurl, :shorl, :snipurl, :metamark,
VF> :makeashorterlink, :skinnylink]
VF> private_method_class:)get_short_url, *@@valid_services)

VF> However, when I generate the doc, only ShortURL.get_short_url is makred
VF> as a private class method, ShortURL.rubyurl and everything are marked
VF> as public class methods.

Static source code analysers will never catch dynamic code generation.
If there is not a real reason for this code i would consider it bad
style (as it looks as ugly as Perl).
 
L

Lothar Scholz

Hello Dr,

DBSD> You mean a better way is keep it simple, like:

DBSD> def rubyurl
DBSD> ...
DBSD> end
DBSD> private :rubyurl

DBSD> def tinyurl
DBSD> ...
DBSD> end
DBSD> private :tinyurl

DBSD> def snipurl
DBSD> ...
DBSD> end
DBSD> private :snipurl

DBSD> ....

DBSD> Am I right?

Or better

class FooUrl
public
def rubyurl; ...; end
def tinyurl; ...; end
def snipurl; ...; end
end

I really find that 80% of the dynamic features of ruby are simply
missued.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top