|
168 | 168 | * Avoid monkey-patching core classes.
|
169 | 169 | * Avoid `return` unless required.
|
170 | 170 | * Avoid superfluous parentheses when calling methods, but keep them when you
|
171 |
| - assign the return value. |
172 |
| - x = Math.sin(y) |
173 |
| - array.delete e |
| 171 | + assign the return value: `x = Math.sin(y); array.delete e` |
174 | 172 | * Avoid ternary operators (`boolean ? true : false`). Use multi-line `if`
|
175 | 173 | instead to emphasize code branches.
|
176 | 174 | * Define the version of Ruby the project uses in the Gemfile.
|
|
181 | 179 | with ActiveRecord and keep `select`/`reject` symmetry.
|
182 | 180 | * Prefer `map` over `collect` and `reduce` over `inject` due to symmetry and
|
183 | 181 | familarity with mapping and reducing in other technologies.
|
184 |
| -* Use `_` for unused block parameters. |
185 |
| - hash.map { |_, v| v + 1 } |
| 182 | +* Use `_` for unused block parameters: `hash.map { |_, v| v + 1 }` |
186 | 183 | * Use `%{}` for single-line strings needing interpolation and double-quotes.
|
187 | 184 | * Use `%w()` over `['', '']` for an array of words.
|
188 | 185 | * Use `&&` and `||` for boolean expressions.
|
@@ -231,8 +228,8 @@ Rails
|
231 | 228 | * Set `config.action_mailer.delivery_method = :test` in the test environment.
|
232 | 229 | * Use `_path` over `_url` for named routes everywhere except mailer views.
|
233 | 230 | * Use `def self.method` over the `named_scope :method` DSL.
|
234 |
| -* Use [Foreman](https://github.com/ddollar/foreman) to run Rails apps in |
235 |
| - development mode. |
| 231 | +* Use [Foreman](https://github.com/ddollar/foreman) to run the development |
| 232 | + server. |
236 | 233 | * Use `I18n.t 'dot.separated.key'` over
|
237 | 234 | `I18n.t :key, :scope => [:dot, :separated]`.
|
238 | 235 | * Use [Haml](http://haml-lang.com) for view templates.
|
|
0 commit comments