Logo: Relish

  1. Sign in

Project: Ruby-style-guide


This Ruby style guide recommends best practices so that real-world Ruby
programmers can write code that can be maintained by other real-world Ruby
programmers. A style guide that reflects real-world usage gets used, and a
style guide that holds to an ideal that has been rejected by the people it is
supposed to help risks not getting used at all – no matter how good it is.

The guide is separated into several sections of related rules. I've
tried to add the rationale behind the rules (if it's omitted I've
assumed it's pretty obvious).

I didn't come up with all the rules out of nowhere - they are mostly
based on my extensive career as a professional software engineer,
feedback and suggestions from members of the Ruby community and
various highly regarded Ruby programming resources, such as
"Programming Ruby 1.9" and "The Ruby Programming Language".

There are some areas in which there is no clear consensus in the
Ruby community regarding a particular style (like string literal quoting,
spacing inside hash literals, dot position in multi-line method
chaining, etc.). In such scenarios all popular styles are acknowledged
and it's up to you to pick one and apply it consistently.

The guide is still a work in progress - some rules are lacking
examples, some rules don't have examples that illustrate them clearly
enough. In due time these issues will be addressed - just keep them in
mind for now.

Forked from The Ruby Style Guide


  1. Source Code Layout
  2. syntax
  3. naming
  5. classes
  6. exceptions
  7. collections
  8. strings
  9. Regular Expressions
  10. Percent Literals
  11. metaprogramming
  12. misc
  13. tools

Last published over 7 years ago by David Kariuki.