app/decorators/attachment_decorator.rb
Use String#start_with?
instead of a regex match anchored to the beginning of the string. Open
Open
if file.content_type =~ /\Aimage/
- Read upRead up
- Exclude checks
This cop identifies unnecessary use of a regex where
String#start_with?
would suffice.
Example:
# bad
'abc' =~ /\Aab/
'abc'.match(/\Aab/)
# good
'abc'.start_with?('ab')