Skip to content

Commit c8313e8

Browse files
committed
added rule to prefer pull.call() over its variants
1 parent 97cef51 commit c8313e8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,22 @@ you if you forget either of the rules above!
948948
p = proc { |n| puts n }
949949
```
950950

951+
* Prefer `proc.call()` over `proc[]` or `proc.()` for both lambdas and procs.
952+
953+
```Ruby
954+
# bad - looks similar to Enumeration access
955+
l = ->(v) { puts v }
956+
l[1]
957+
958+
# also bad - uncommon syntax
959+
l = ->(v) { puts v }
960+
l.(1)
961+
962+
# good
963+
l = ->(v) { puts v }
964+
l.call(1)
965+
```
966+
951967
* Use `_` for unused block parameters.
952968

953969
```Ruby

0 commit comments

Comments
 (0)