summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/pic.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-06-05 15:53:15 +0200
committerGeremia Taglialatela <[email protected]>2023-06-05 17:27:41 +0200
commit7fdbd745a2c914001a2174aeadae26b9c970ffaf (patch)
tree9b1a440ef0bee0ecaaeb7c991dcc9d8639cb7b6d /lib/axlsx/drawing/pic.rb
parenta2eeaeefca8deb3d26f3f8dc62976fe6bf1dafcf (diff)
downloadcaxlsx-7fdbd745a2c914001a2174aeadae26b9c970ffaf.tar.gz
caxlsx-7fdbd745a2c914001a2174aeadae26b9c970ffaf.zip
Fix Style/FormatString offenses
`Kernel#format` is faster and will avoid to allocate an array compared to `String#%`. ``` IPS: kernel_format: 3877614.2 i/s string_percent: 3531475.0 i/s - 1.10x (± 0.00) slower Memory: kernel_format: 160 allocated string_percent: 200 allocated - 1.25x more ```
Diffstat (limited to 'lib/axlsx/drawing/pic.rb')
-rw-r--r--lib/axlsx/drawing/pic.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/axlsx/drawing/pic.rb b/lib/axlsx/drawing/pic.rb
index 150d6dc5..c9efb378 100644
--- a/lib/axlsx/drawing/pic.rb
+++ b/lib/axlsx/drawing/pic.rb
@@ -124,7 +124,7 @@ module Axlsx
# The part name for this image used in serialization and relationship building
# @return [String]
def pn
- "#{IMAGE_PN % [(index + 1), extname]}"
+ format(IMAGE_PN, index + 1, extname)
end
# The relationship object for this pic.