Skip to content

Files

Latest commit

 

History

History
26 lines (18 loc) · 462 Bytes

Performance-StringInclude.md

File metadata and controls

26 lines (18 loc) · 462 Bytes

Pattern: Missing use of String#include?

Issue: -

Description

Identifies unnecessary use of a regex where String#include? would suffice.

Examples

# bad
'abc'.match?(/ab/)
/ab/.match?('abc')
'abc' =~ /ab/
/ab/ =~ 'abc'
'abc'.match(/ab/)
/ab/.match('abc')

# good
'abc'.include?('ab')

Further Reading