[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Standard File Naming Conventions

pachl

10/19/2008 1:30:00 AM

For a file containing the given class, SomeCoolClass, what would be
the proper filename?

1) somecoolclass.rb
2) some_cool_class.rb
3) some-cool-class.rb
4) SomeCoolClass.rb

or some other variation?

I noticed in the Ruby stdlib, versions 1, 2 and 3 are used.
1 Answer

Henrik Nyh

10/19/2008 7:30:00 AM

0

On Sun, Oct 19, 2008 at 3:29 AM, pachl <clintpachl@gmail.com> wrote:
> For a file containing the given class, SomeCoolClass, what would be
> the proper filename?
>
> 1) somecoolclass.rb
> 2) some_cool_class.rb
> 3) some-cool-class.rb
> 4) SomeCoolClass.rb
>
> or some other variation?
>
> I noticed in the Ruby stdlib, versions 1, 2 and 3 are used.

I'm not sure about the Ruby convention here, but I know Ruby on Rails
uses #2 (some_cool_class.rb).

In Rails, this convention is necessary for some of the magic: if you
reference MyConstant::MyClass and it's not known, Rails uses
const_missing to translate that to my_constant/my_class and tries to
find that in the load path.