From 7b220f91322ca7bdee393ddbc3327c50a45fbbcd Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 20 May 2023 17:35:54 +0200 Subject: Fix Style/AndOr offenses From Ruby Style Guide: > Do not use `and` and `or` in boolean context - and and or are control flow operators and should be used as such. They have very low precedence, and can be used as a short form of specifying flow sequences like "evaluate expression 1, and only if it is not successful (returned `nil`), evaluate expression 2". This is especially useful for raising errors or early return without breaking the reading flow. Also: - Remove redundant use of self - Use attribute reader instead of accessing instance variable --- lib/axlsx/workbook/worksheet/data_validation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/axlsx/workbook/worksheet/data_validation.rb b/lib/axlsx/workbook/worksheet/data_validation.rb index eca90743..bc9bc527 100644 --- a/lib/axlsx/workbook/worksheet/data_validation.rb +++ b/lib/axlsx/workbook/worksheet/data_validation.rb @@ -243,8 +243,8 @@ module Axlsx str << key_value.first << '="' << Axlsx.booleanize(key_value.last).to_s << '"' end str << '>' - str << '' << self.formula1 << '' if @formula1 and valid_attributes.include?(:formula1) - str << '' << self.formula2 << '' if @formula2 and valid_attributes.include?(:formula2) + str << '' << formula1 << '' if formula1 && valid_attributes.include?(:formula1) + str << '' << formula2 << '' if formula2 && valid_attributes.include?(:formula2) str << '' end -- cgit v1.2.3