diff options
| author | Geremia Taglialatela <[email protected]> | 2023-05-23 01:29:34 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-05-31 09:58:46 +0200 |
| commit | 86026e2f106cb982f58f5a876756507d051aee4b (patch) | |
| tree | 192cb431e2f5af9323d32466709e7305b48520fb /lib/axlsx/stylesheet | |
| parent | 3aa92cd2be4b535d1b21d2ba02f0e7660ccc6a05 (diff) | |
| download | caxlsx-86026e2f106cb982f58f5a876756507d051aee4b.tar.gz caxlsx-86026e2f106cb982f58f5a876756507d051aee4b.zip | |
Fix Style/SymbolProc offenses
This also provides a performance improvement
```
Comparison (array of 4 elements):
map(&): 3643131.4 i/s
map {}: 3488052.5 i/s - 1.04x (± 0.00) slower
Comparison (array of 20 elements):
map(&): 466013.9 i/s
map {}: 408447.2 i/s - 1.14x (± 0.00) slower
```
Diffstat (limited to 'lib/axlsx/stylesheet')
| -rw-r--r-- | lib/axlsx/stylesheet/styles.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index c3dd8d06..2bad15e8 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -470,7 +470,7 @@ module Axlsx # When the type is :dxf we always need to create a new numFmt object if options[:format_code] || options[:type] == :dxf # If this is a standard xf we pull from numFmts the highest current and increment for num_fmt - options[:num_fmt] ||= (@numFmts.map { |num_fmt| num_fmt.numFmtId }.max + 1) if options[:type] != :dxf + options[:num_fmt] ||= (@numFmts.map(&:numFmtId).max + 1) if options[:type] != :dxf numFmt = NumFmt.new(:numFmtId => options[:num_fmt] || 0, :formatCode => options[:format_code].to_s) options[:type] == :dxf ? numFmt : (numFmts << numFmt; numFmt.numFmtId) else |
