From 383195708d2c16c9fa132738c41ac895ac701a9e Mon Sep 17 00:00:00 2001 From: Koza Date: Wed, 12 Apr 2023 18:40:03 +0200 Subject: Fix warnings with Ruby 2.x --- lib/axlsx.rb | 2 +- lib/axlsx/workbook/worksheet/worksheet.rb | 2 +- 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? -- cgit v1.2.3