Skip to content

Commit 4dac788

Browse files
committed
Chunk Ruby guides by theme
I tried to extract some themes out of the Ruby guides and chunked a few chunks: - Stuff I didn't touch - method definitions/signature - variables/params
1 parent a46e47a commit 4dac788

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

ruby/README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@
99
- [Use an opinionated set of rules for Rubocop](Use-an-opinionated-set-of-rules-for-Rubocop.md)
1010
- [Limit use of conditional modifiers to short, simple cases](Limit-use-of-conditional-modifiers-to-short-simple-cases.md)
1111
- Avoid multiple assignments per line (`one, two = 1, 2`). [#109]
12-
- Avoid organizational comments (`# Validations`). [#63]
1312
- Avoid ternary operators (`boolean ? true : false`). Use multi-line `if`
1413
instead to emphasize code branches. [36491dbb9]
15-
- Avoid bang (!) method names. Prefer descriptive names. [#122]
16-
- Name variables created by a factory after the factory (`user_factory` creates
17-
`user`).
1814
- Prefer nested class and module definitions over the shorthand version
1915
[Example](/ruby/sample_1.rb#L103) [#332]
2016
- Prefer `detect` over `find`. [0d819844]
@@ -23,28 +19,37 @@
2319
- Prefer `reduce` over `inject`. [#237]
2420
- Prefer `&:method_name` to `{ |item| item.method_name }` for simple method
2521
calls. [#183]
26-
- Use `_` for unused block parameters. [0d819844]
27-
- Prefix unused variables or parameters with underscore (`_`). [#335]
28-
- Suffix variables holding a factory with `_factory` (`user_factory`).
29-
- Use a leading underscore when defining instance variables for memoization.
30-
[#373]
3122
- Use `%()` for single-line strings containing double-quotes that require
3223
interpolation. [36491dbb9]
33-
- Use `?` suffix for predicate methods. [0d819844]
34-
- Use `def self.method`, not `class << self`. [40090e22]
35-
- Use `def` with parentheses when there are arguments. [36491dbb9]
3624
- Use heredocs for multi-line strings. [36491dbb9]
37-
- Order class methods above instance methods. [#320]
38-
- Prefer method invocation over instance variables. [#331]
39-
- Avoid optional parameters. Does the method do too much?
4025
- Avoid monkey-patching.
4126
- Generate necessary [Bundler binstubs] for the project, such as `rake` and
4227
`rspec`, and add them to version control.
4328
- Prefer classes to modules when designing functionality that is shared by
4429
multiple models.
30+
- Avoid organizational comments (`# Validations`). [#63]
31+
- Use empty lines around multi-line blocks.
32+
33+
---
34+
35+
- Avoid bang (!) method names. Prefer descriptive names. [#122]
36+
- Use `?` suffix for predicate methods. [0d819844]
37+
- Use `def self.method`, not `class << self`. [40090e22]
38+
- Use `def` with parentheses when there are arguments. [36491dbb9]
39+
- Avoid optional parameters. Does the method do too much?
40+
- Order class methods above instance methods. [#320]
4541
- Prefer `private` when indicating scope. Use `protected` only with comparison
4642
methods like `def ==(other)`, `def <(other)`, and `def >(other)`.
47-
- Use empty lines around multi-line blocks.
43+
44+
---
45+
46+
- Prefix unused variables or parameters with underscore (`_`). [#335]
47+
- Name variables created by a factory after the factory (`user_factory` creates
48+
`user`).
49+
- Suffix variables holding a factory with `_factory` (`user_factory`).
50+
- Use a leading underscore when defining instance variables for memoization.
51+
[#373]
52+
- Prefer method invocation over instance variables. [#331]
4853

4954
[#63]: https://github.com/thoughtbot/guides/pull/63
5055
[#109]: https://github.com/thoughtbot/guides/pull/109

0 commit comments

Comments
 (0)