Here is a short guideline for the style to use in the project.
- Indent with two spaces
- Leave a blank line at the end of file
Generally speaking, just follow Ruby (and Rails) coding style convention.
-
Class names in
PascalCase
-
Variable names in
snake_case
-
Use brackets only for single line block:
foo.map { |e| e + 1 }
-
Use
do
andend
for multiple line blocks:foo.each do |e| array << e puts e end
-
Use
then
only in single lineif
:a = if condition then 1 else 3
in other cases just use
if
:if foo bar else baz end
- Class names in
PascalCase
- Variable names in
camelCase