Coding Standards¶
- 3 space indentation. No tabs.
- All VALUE's should start with 'v_', except for self or klass.
- Single point of return whenever possible.
- No brackets on if/for/while if one line only, unless followed by multi-line else. Use vertical spacing for separation.
- Use '//' for single line comments
h2. Coding Standard Examples
// Single line if
if(NIL_P(v_size))
x = y + z;
// Multi-line if
if(NIL_P(v_size)){
x = y + z;
a = b + c;
}
// Single line if and single line else
if(NIL_P(v_size))
x = y + z;
else
a = b + c;
// Single line if followed by multi-line else
if(NIL_P(v_size)){
x = y + z;
}
else{
x = y / z;
a = b / c;
}
Also available in:
HTML
TXT