Rubocop fix: Perfomance/UnfreezeString
(#26217)
This commit is contained in:
parent
4d1b67f664
commit
30f5ec7303
6 changed files with 33 additions and 18 deletions
|
@ -14,13 +14,14 @@ class RSS::Builder
|
|||
end
|
||||
|
||||
def to_xml
|
||||
('<?xml version="1.0" encoding="UTF-8"?>'.dup << Ox.dump(wrap_in_document, effort: :tolerant)).force_encoding('UTF-8')
|
||||
Ox.dump(wrap_in_document, effort: :tolerant).force_encoding('UTF-8')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wrap_in_document
|
||||
Ox::Document.new(version: '1.0').tap do |document|
|
||||
document << xml_instruct
|
||||
document << Ox::Element.new('rss').tap do |rss|
|
||||
rss['version'] = '2.0'
|
||||
rss['xmlns:webfeeds'] = 'http://webfeeds.org/rss/1.0'
|
||||
|
@ -30,4 +31,11 @@ class RSS::Builder
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def xml_instruct
|
||||
Ox::Instruct.new(:xml).tap do |instruct|
|
||||
instruct[:version] = '1.0'
|
||||
instruct[:encoding] = 'UTF-8'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -75,7 +75,7 @@ class TextFormatter
|
|||
entity[:indices].first
|
||||
end
|
||||
|
||||
result = ''.dup
|
||||
result = +''
|
||||
|
||||
last_index = entities.reduce(0) do |index, entity|
|
||||
indices = entity[:indices]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue