Rubocop: Performance/StringReplacement
- Use delete! instead of gsub! - Use tr instead of gsub
This commit is contained in:
parent
ff5f7b7120
commit
d157a04c6d
|
@ -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>"
|
||||||
|
|
Loading…
Reference in New Issue