Code Conventions for Ruby

D

Dave Burt

... Code Conventions for Ruby ... ?

TMTOWTDI

A bit like Perl, which can get messy, except the language itself, by things
like newlines instead of semicolons, encourages you to write legibly (or
maybe the newlines/semicolons thing is the only way).

Actually, now I think more about it, there seems to be almost a de-facto
standard of two spaces per indentation level.

And, now I do some research, I find that there's the start of a collection
of this kind of thing in the RubyGarden:
http://www.rubygarden.org/ruby?RubyStyleGuide
 
D

David Alan Black

Hi --

Dave Burt said:

But even in Perl, whose motto that is, that doesn't mean everything is
equally smiled upon; Perl actually comes with a style guide :)
A bit like Perl, which can get messy, except the language itself, by things
like newlines instead of semicolons, encourages you to write legibly (or
maybe the newlines/semicolons thing is the only way).

Actually, now I think more about it, there seems to be almost a de-facto
standard of two spaces per indentation level.

And, now I do some research, I find that there's the start of a collection
of this kind of thing in the RubyGarden:
http://www.rubygarden.org/ruby?RubyStyleGuide

See also:

http://pub.cozmixng.org/~the-rwiki/rw-cgi.rb?cmd=view;name=RubyCodingConvention

You can also look to the Ruby core library for guidance on style
matters. It's not completely uniform but it's very close in certain
matters that come up again and again (indentation, variable_names,
etc.). That way, even if you decide to depart from aspects of Matz's
style, you'll at least know you're doing so :)


David
 

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

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top