summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/package.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-06-02 20:55:14 +0200
committerGeremia Taglialatela <[email protected]>2023-06-02 20:55:14 +0200
commit4195130bb4633bc667aeedd297dc56d7632a5810 (patch)
tree58a96dd864cc81c66c14499b6b6de40dbcd1d936 /lib/axlsx/package.rb
parentad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd (diff)
downloadcaxlsx-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/package.rb')
-rw-r--r--lib/axlsx/package.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb
index 26f838f8..6aec6930 100644
--- a/lib/axlsx/package.rb
+++ b/lib/axlsx/package.rb
@@ -101,7 +101,7 @@ module Axlsx
# s = p.to_stream()
# File.open('example_streamed.xlsx', 'wb') { |f| f.write(s.read) }
def serialize(output, options = {}, secondary_options = nil)
- if !workbook.styles_applied
+ unless workbook.styles_applied
workbook.apply_styles
end
@@ -126,7 +126,7 @@ module Axlsx
# @param [Boolean] confirm_valid Validate the package prior to serialization.
# @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not.
def to_stream(confirm_valid = false)
- if !workbook.styles_applied
+ unless workbook.styles_applied
workbook.apply_styles
end