diff options
| author | Zsolt Kozaroczy <[email protected]> | 2023-05-31 09:40:33 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-31 09:40:33 +0200 |
| commit | 3aa92cd2be4b535d1b21d2ba02f0e7660ccc6a05 (patch) | |
| tree | e3de34b429cf443edaaeca2800d1c35203178d8b | |
| parent | 8918a00eb0ff7b40240be5c94c4c245c95579acb (diff) | |
| parent | 2ed27823eaeb345e383343fb70dfa3f205f71ca1 (diff) | |
| download | caxlsx-3aa92cd2be4b535d1b21d2ba02f0e7660ccc6a05.tar.gz caxlsx-3aa92cd2be4b535d1b21d2ba02f0e7660ccc6a05.zip | |
Merge pull request #249 from tagliala/chore/use-each-key
Fix Style/HashEachMethods offense
| -rw-r--r-- | .rubocop_todo.yml | 7 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/rich_text_run.rb | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c53b9f5c..ae3b1d2a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -229,13 +229,6 @@ Style/GuardClause: - 'lib/axlsx/workbook/worksheet/table.rb' - 'lib/axlsx/workbook/worksheet/worksheet.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowedReceivers. -# AllowedReceivers: Thread.current -Style/HashEachMethods: - Exclude: - - 'lib/axlsx/workbook/worksheet/rich_text_run.rb' - # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb index ffd2f941..e3522d4c 100644 --- a/lib/axlsx/workbook/worksheet/rich_text_run.rb +++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb @@ -211,14 +211,14 @@ module Axlsx data = data.select { |key, value| valid.include?(key) && !value.nil? } str << '<r><rPr>' - data.keys.each do |key| + data.each do |key, val| case key when :font_name str << '<rFont val="' << font_name << '"/>' when :color - str << data[key].to_xml_string + str << val.to_xml_string else - str << '<' << key.to_s << ' val="' << xml_value(data[key]) << '"/>' + str << '<' << key.to_s << ' val="' << xml_value(val) << '"/>' end end clean_value = Axlsx::trust_input ? @value.to_s : ::CGI.escapeHTML(Axlsx::sanitize(@value.to_s)) |
