Skip to content

Files

Latest commit

 

History

History
23 lines (15 loc) · 445 Bytes

Performance-Squeeze.md

File metadata and controls

23 lines (15 loc) · 445 Bytes

Pattern: Missing use of squeeze method

Issue: -

Description

Identifies places where gsub(/a+/, 'a') and gsub!(/a+/, 'a') can be replaced by squeeze('a') and squeeze!('a').

Examples

# bad
str.gsub(/a+/, 'a')
str.gsub!(/a+/, 'a')

# good
str.squeeze('a')
str.squeeze!('a')

Further Reading