diff options
| author | Geremia Taglialatela <[email protected]> | 2023-05-16 15:54:08 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-05-16 15:54:08 +0200 |
| commit | 6eb2fc56d3ab658edc1477d138b1cf0b3021ab29 (patch) | |
| tree | 57874b36a7a87dd9610df7209cc52a03a4114961 /lib/axlsx/drawing/num_data_source.rb | |
| parent | 3b9ac17d8e4dc8b315ac307ffad6f2aa0cb96741 (diff) | |
| download | caxlsx-6eb2fc56d3ab658edc1477d138b1cf0b3021ab29.tar.gz caxlsx-6eb2fc56d3ab658edc1477d138b1cf0b3021ab29.zip | |
Replace `sub` with `delete_prefix`/`delete_suffix`
Ruby 2.5 introduced `delete_prefix` and `delete_suffix`.
Those methods are helpful when serializing formula and array formula
values, that are supposed to start and end with given prefixes
Also moves formula prefix to constants so they can be used by both
`Cell` and `CellSerializer` classes
Formula:
```
Ruby version: 3.2.2
Comparison:
delete_prefix: 8759353.5 i/s
sub: 2607022.4 i/s - 3.36x (± 0.00) slower
Comparison:
delete_prefix: 40 allocated
sub: 160 allocated - 4.00x more
```
Array Formula:
```
Ruby version: 3.2.2
Comparison:
delete_prefixes: 4798837.8 i/s
sub_sub: 937072.1 i/s - 5.12x (± 0.00) slower
Comparison:
delete_prefixes: 120 allocated
sub_sub: 488 allocated - 4.07x more
```
Diffstat (limited to 'lib/axlsx/drawing/num_data_source.rb')
0 files changed, 0 insertions, 0 deletions
