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
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ Translations of the guide are available in the following languages:
```

* <a name="method-parens"></a>
Use `def` with parentheses when there are arguments. Omit the
parentheses when the method doesn't accept any arguments.
Use `def` with parentheses when there are parameters. Omit the
parentheses when the method doesn't accept any parameters.
<sup>[[link](#method-parens)]</sup>

```Ruby
Expand All @@ -640,12 +640,12 @@ Translations of the guide are available in the following languages:
end

# bad
def some_method_with_arguments arg1, arg2
def some_method_with_parameters param1, param2
# body omitted
end

# good
def some_method_with_arguments(arg1, arg2)
def some_method_with_parameters(param1, param2)
# body omitted
end
```
Expand Down Expand Up @@ -1925,7 +1925,7 @@ condition](#safe-assignment-in-condition).
<sup>[[link](#reduce-blocks)]</sup>

* <a name="other-arg"></a>
When defining binary operators, name the argument `other`(`<<` and `[]` are
When defining binary operators, name the parameter `other`(`<<` and `[]` are
exceptions to the rule, since their semantics are different).
<sup>[[link](#other-arg)]</sup>

Expand Down Expand Up @@ -3282,11 +3282,11 @@ condition](#safe-assignment-in-condition).
UNSAFE_STRING_METHODS.each do |unsafe_method|
if 'String'.respond_to?(unsafe_method)
class_eval <<-EOT, __FILE__, __LINE__ + 1
def #{unsafe_method}(*args, &block) # def capitalize(*args, &block)
def #{unsafe_method}(*params, &block) # def capitalize(*params, &block)
to_str.#{unsafe_method}(*args, &block) # to_str.capitalize(*args, &block)
end # end

def #{unsafe_method}!(*args) # def capitalize!(*args)
def #{unsafe_method}!(*params) # def capitalize!(*params)
@dirty = true # @dirty = true
super # super
end # end
Expand All @@ -3310,7 +3310,7 @@ condition](#safe-assignment-in-condition).

```ruby
# bad
def method_missing?(meth, *args, &block)
def method_missing?(meth, *params, &block)
if /^find_by_(?<prop>.*)/ =~ meth
# ... lots of code to do a find_by
else
Expand All @@ -3319,7 +3319,7 @@ condition](#safe-assignment-in-condition).
end

# good
def method_missing?(meth, *args, &block)
def method_missing?(meth, *params, &block)
if /^find_by_(?<prop>.*)/ =~ meth
find_by(prop, *args, &block)
else
Expand Down Expand Up @@ -3394,7 +3394,7 @@ condition](#safe-assignment-in-condition).
Code in a functional way, avoiding mutation when that makes sense.
<sup>[[link](#functional-code)]</sup>

* <a name="no-arg-mutations"></a>
* <a name="no-param-mutations"></a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. "Parameter mutation" sounds a bit strange to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, sounds odd. Changed this and the following back to arguments

Do not mutate arguments unless that is the purpose of the method.
<sup>[[link](#no-arg-mutations)]</sup>

Expand Down