From 4bf0ab60682324873bbd250499c1de09fcf93b12 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 2 Jul 2023 10:44:03 +0200 Subject: Require 'cgi' at module level Previously, `require 'cgi'` was only called in `cell.rb`, but there are other components in the Axlsx module that also use this dependency, including `Axlsx::SeriesTitle`, `Axlsx::StrVal`, `Axlsx::Title` (drawing), `Axlsx::Comment`, `Axlsx::ConditionalFormattingRule`, and `Axlsx::HeaderFooter`. By requiring cgi at the module level, we ensure that this dependency is available to all components in the Axlsx module, which can prevent issues if someone is requiring specific components that depend on cgi. This change improves the maintainability and reliability of the codebase by ensuring that all components have access to the required dependencies. Close #282 --- lib/axlsx.rb | 1 + lib/axlsx/workbook/worksheet/cell.rb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/axlsx.rb b/lib/axlsx.rb index aeef2dfc..02bbabaa 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -30,6 +30,7 @@ require 'zip' # core dependencies require 'bigdecimal' +require 'cgi' require 'set' require 'time' diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index b8b4fea5..2ff3a3cc 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'cgi' module Axlsx # A cell in a worksheet. # Cell stores inforamation requried to serialize a single worksheet cell to xml. You must provde the Row that the cell belongs to and the cells value. The data type will automatically be determed if you do not specify the :type option. The default style will be applied if you do not supply the :style option. Changing the cell's type will recast the value to the type specified. Altering the cell's value via the property accessor will also automatically cast the provided value to the cell's type. -- cgit v1.2.3