mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-20 15:31:12 +00:00
code cleanup: rubocop: fix Performance/Casecmp in lib/redmine/codeset_util.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18503 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8fb0ec3c3b
commit
f66cc7db80
@ -727,7 +727,6 @@ Naming/VariableNumber:
|
||||
# Cop supports --auto-correct.
|
||||
Performance/Casecmp:
|
||||
Exclude:
|
||||
- 'lib/redmine/codeset_util.rb'
|
||||
- 'lib/redmine/scm/adapters/bazaar_adapter.rb'
|
||||
|
||||
Performance/FixedSize:
|
||||
|
||||
@ -22,7 +22,7 @@ module Redmine
|
||||
return str
|
||||
end
|
||||
enc = encoding.blank? ? "UTF-8" : encoding
|
||||
if enc.upcase != "UTF-8"
|
||||
if enc.casecmp("UTF-8") != 0
|
||||
str.force_encoding(enc)
|
||||
str = str.encode("UTF-8", :invalid => :replace,
|
||||
:undef => :replace, :replace => '?')
|
||||
@ -62,7 +62,7 @@ module Redmine
|
||||
str = str.dup
|
||||
str ||= ''
|
||||
str.force_encoding('UTF-8')
|
||||
if encoding.upcase != 'UTF-8'
|
||||
if encoding.casecmp('UTF-8') != 0
|
||||
str = str.encode(encoding, :invalid => :replace,
|
||||
:undef => :replace, :replace => '?')
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user