Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
- [Use an opinionated set of rules for Rubocop](Use-an-opinionated-set-of-rules-for-Rubocop.md)
- [Limit use of conditional modifiers to short, simple cases](Limit-use-of-conditional-modifiers-to-short-simple-cases.md)
- Avoid multiple assignments per line (`one, two = 1, 2`). [#109]
- Avoid organizational comments (`# Validations`). [#63]
- Avoid ternary operators (`boolean ? true : false`). Use multi-line `if`
instead to emphasize code branches. [36491dbb9]
- Avoid bang (!) method names. Prefer descriptive names. [#122]
- Name variables created by a factory after the factory (`user_factory` creates
`user`).
- Prefer nested class and module definitions over the shorthand version
[Example](/ruby/sample_1.rb#L103) [#332]
- Prefer `detect` over `find`. [0d819844]
Expand All @@ -23,28 +19,37 @@
- Prefer `reduce` over `inject`. [#237]
- Prefer `&:method_name` to `{ |item| item.method_name }` for simple method
calls. [#183]
- Use `_` for unused block parameters. [0d819844]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this one, as it's the same as the one below it

- Prefix unused variables or parameters with underscore (`_`). [#335]
- Suffix variables holding a factory with `_factory` (`user_factory`).
- Use a leading underscore when defining instance variables for memoization.
[#373]
- Use `%()` for single-line strings containing double-quotes that require
interpolation. [36491dbb9]
- Use `?` suffix for predicate methods. [0d819844]
- Use `def self.method`, not `class << self`. [40090e22]
- Use `def` with parentheses when there are arguments. [36491dbb9]
- Use heredocs for multi-line strings. [36491dbb9]
- Order class methods above instance methods. [#320]
- Prefer method invocation over instance variables. [#331]
- Avoid optional parameters. Does the method do too much?
- Avoid monkey-patching.
- Generate necessary [Bundler binstubs] for the project, such as `rake` and
`rspec`, and add them to version control.
- Prefer classes to modules when designing functionality that is shared by
multiple models.
- Avoid organizational comments (`# Validations`). [#63]
- Use empty lines around multi-line blocks.

---

- Avoid bang (!) method names. Prefer descriptive names. [#122]
- Use `?` suffix for predicate methods. [0d819844]
- Use `def self.method`, not `class << self`. [40090e22]
- Use `def` with parentheses when there are arguments. [36491dbb9]
- Avoid optional parameters. Does the method do too much?
- Order class methods above instance methods. [#320]
- Prefer `private` when indicating scope. Use `protected` only with comparison
methods like `def ==(other)`, `def <(other)`, and `def >(other)`.
- Use empty lines around multi-line blocks.

---

- Prefix unused variables or parameters with underscore (`_`). [#335]
- Name variables created by a factory after the factory (`user_factory` creates
`user`).
- Suffix variables holding a factory with `_factory` (`user_factory`).
- Use a leading underscore when defining instance variables for memoization.
[#373]
- Prefer method invocation over instance variables. [#331]

[#63]: https://github.com/thoughtbot/guides/pull/63
[#109]: https://github.com/thoughtbot/guides/pull/109
Expand Down