summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKoza <[email protected]>2023-04-12 18:40:03 +0200
committerKoza <[email protected]>2023-04-12 18:40:03 +0200
commit383195708d2c16c9fa132738c41ac895ac701a9e (patch)
treea027fe57302653014348690fe56031837ae68109
parent79c2802f94b3a2ee7ba7470ac7f0d3ffbd92ea0a (diff)
downloadcaxlsx-383195708d2c16c9fa132738c41ac895ac701a9e.tar.gz
caxlsx-383195708d2c16c9fa132738c41ac895ac701a9e.zip
Fix warnings with Ruby 2.x
-rw-r--r--lib/axlsx.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb
index 9dba9144..0fd8260c 100644
--- a/lib/axlsx.rb
+++ b/lib/axlsx.rb
@@ -206,7 +206,7 @@ module Axlsx
# See https://www.owasp.org/index.php/CSV_Injection for details.
# @return [Boolean]
def self.escape_formulas
- @escape_formulas.nil? ? false : @escape_formulas
+ !defined?(@escape_formulas) || @escape_formulas.nil? ? false : @escape_formulas
end
# Sets whether to treat values starting with an equals sign as formulas or as literal strings.
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 38fb5254..b4cad5be 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -21,7 +21,7 @@ module Axlsx
@sheet_protection = nil
initialize_page_options(options)
parse_options options
- self.escape_formulas = wb.escape_formulas if @escape_formulas.nil?
+ self.escape_formulas = wb.escape_formulas unless defined? @escape_formulas
@workbook.worksheets << self
@sheet_id = index + 1
yield self if block_given?