app/controllers/cases_controller.rb
Use delete
instead of gsub
. Open
Open
params[:case_file][:worker_attributes][:type] = "#{params[:case_file][:case_type].gsub('-', '')}Worker" if params[:case_file][:case_type]
- Read upRead up
- Exclude checks
This cop identifies places where gsub
can be replaced by
tr
or delete
.
Example:
# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')
# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')