diff options
| author | Geremia Taglialatela <[email protected]> | 2023-06-02 20:55:14 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-06-02 20:55:14 +0200 |
| commit | 4195130bb4633bc667aeedd297dc56d7632a5810 (patch) | |
| tree | 58a96dd864cc81c66c14499b6b6de40dbcd1d936 /lib/axlsx/workbook/worksheet | |
| parent | ad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd (diff) | |
| download | caxlsx-4195130bb4633bc667aeedd297dc56d7632a5810.tar.gz caxlsx-4195130bb4633bc667aeedd297dc56d7632a5810.zip | |
Fix negated if offenses
Should also provide a negligible performance improvement, about 3%
on Ruby 3.2 and 6% on Ruby 2.6 (M1 Pro)
Diffstat (limited to 'lib/axlsx/workbook/worksheet')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/border_creator.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index 9abaded5..04a9cfac 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -17,7 +17,7 @@ module Axlsx else @edges = @edges.map { |x| x&.to_sym }.uniq - if !(@edges - Axlsx::Border::EDGES).empty? + unless (@edges - Axlsx::Border::EDGES).empty? raise ArgumentError, "Invalid edges provided, #{edges}" end end diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 90461c66..b62f3790 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -584,7 +584,7 @@ module Axlsx # @param [String|Array] cell_refs Cell references # @param [Hash] styles def add_style(cell_refs, *styles) - if !cell_refs.is_a?(Array) + unless cell_refs.is_a?(Array) cell_refs = [cell_refs] end @@ -613,7 +613,7 @@ module Axlsx border_edges = options end - if !cell_refs.is_a?(Array) + unless cell_refs.is_a?(Array) cell_refs = [cell_refs] end @@ -850,7 +850,7 @@ module Axlsx end def add_autofilter_defined_name_to_workbook - return if !auto_filter.range + return unless auto_filter.range workbook.add_defined_name auto_filter.defined_name, name: '_xlnm._FilterDatabase', local_sheet_id: index, hidden: 1 end |
