[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RDoc: bug or limitation?

Vincent Foley

6/4/2005 7:53:00 PM

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.

4 Answers

Gennady

6/4/2005 8:02:00 PM

0

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.

On Jun 4, 2005, at 12:55, Vincent Foley wrote:

> 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.
>
>



Lothar Scholz

6/4/2005 9:01:00 PM

0

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).


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ru...
CTO Scriptolutions Ruby, PHP, Python IDE 's




Balwinder S Dheeman

6/6/2005 3:44:00 AM

0

On 06/05/2005 02:30 AM, Lothar Scholz wrote:
> 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).

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

def rubyurl
...
end
private :rubyurl

def tinyurl
...
end
private :tinyurl

def snipurl
...
end
private :snipurl

....

Am I right?

--
Dr Balwinder Singh Dheeman Registered Linux User: #229709
CLLO (Chief Linux Learning Officer) Machines: #168573, 170593, 259192
Anu's Linux@HOME Distros: Ubuntu, Fedora, Knoppix
More: http://anu.homelinux... Visit: http://count...

Lothar Scholz

6/6/2005 9:53:00 AM

0

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.


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ru...
CTO Scriptolutions Ruby, PHP, Python IDE 's