Rubocop: Performance/StringReplacement

- Use delete! instead of gsub!
 - Use tr instead of gsub
This commit is contained in:
Pat Hawks 2016-01-03 15:47:31 -08:00
parent ff5f7b7120
commit d157a04c6d
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ module Jekyll
key, value = opt.split('=') key, value = opt.split('=')
# If a quoted list, convert to array # If a quoted list, convert to array
if value && value.include?("\"") if value && value.include?("\"")
value.gsub!(/"/, "") value.delete!('"')
value = value.split value = value.split
end end
@highlight_options[key.to_sym] = value || true @highlight_options[key.to_sym] = value || true
@ -110,7 +110,7 @@ eos
def add_code_tag(code) def add_code_tag(code)
code_attributes = [ code_attributes = [
"class=\"language-#{@lang.to_s.gsub('+', '-')}\"", "class=\"language-#{@lang.to_s.tr('+', '-')}\"",
"data-lang=\"#{@lang.to_s}\"" "data-lang=\"#{@lang.to_s}\""
].join(" ") ].join(" ")
"<figure class=\"highlight\"><pre><code #{code_attributes}>#{code.chomp}</code></pre></figure>" "<figure class=\"highlight\"><pre><code #{code_attributes}>#{code.chomp}</code></pre></figure>"