Commit b76bf20a49b6a208337ff1464b627195807071ce

Authored by Laust Rud Jacobsen
1 parent c30adbfc
Exists in master and in 1 other branch production

Rubocop: perfer .tr over .gsub when just replacing chars

.rubocop_todo.yml
... ... @@ -33,13 +33,6 @@ Metrics/MethodLength:
33 33 Metrics/PerceivedComplexity:
34 34 Max: 12
35 35  
36   -# Offense count: 2
37   -# Cop supports --auto-correct.
38   -Performance/StringReplacement:
39   - Exclude:
40   - - 'app/models/notification_services/gtalk_service.rb'
41   - - 'lib/hoptoad/v2.rb'
42   -
43 36 # Offense count: 4
44 37 # Cop supports --auto-correct.
45 38 # Configuration parameters: Include.
... ...
app/models/notification_services/gtalk_service.rb
... ... @@ -60,7 +60,7 @@ class NotificationServices::GtalkService < NotificationService
60 60 private
61 61  
62 62 def send_to_users client, message
63   - user_id.gsub(/ /i, ",").gsub(/;/i, ",").split(",").map(&:strip).reject(&:empty?).each do |user|
  63 + user_id.tr(' ', ",").tr(';', ",").split(",").map(&:strip).reject(&:empty?).each do |user|
64 64 client.send(Jabber::Message.new(user, message))
65 65 end
66 66 end
... ...
lib/hoptoad/v2.rb
... ... @@ -36,7 +36,7 @@ module Hoptoad
36 36 end
37 37  
38 38 def self.normalize_key(key)
39   - key.gsub('.', '_')
  39 + key.tr('.', '_')
40 40 end
41 41  
42 42 def self.normalize(notice)
... ...