Skip to content

Files

Latest commit

 

History

History
32 lines (23 loc) · 736 Bytes

Lint-AmbiguousBlockAssociation.md

File metadata and controls

32 lines (23 loc) · 736 Bytes

Pattern: Ambiguous block association

Issue: -

Description

This rule checks for ambiguous block association with method when param is passed without parentheses.

Examples

# bad
some_method a { |val| puts val }
# good
# With parentheses, there's no ambiguity.
some_method(a) { |val| puts val }

# good
# Operator methods require no disambiguation
foo == bar { |b| b.baz }

# good
# Lambda arguments require no disambiguation
foo = ->(bar) { bar.baz }

Further Reading