summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx
diff options
context:
space:
mode:
authorAdam Kiczula <[email protected]>2023-05-20 09:21:01 -0500
committerAdam Kiczula <[email protected]>2023-05-20 09:24:35 -0500
commit5277073210c711a1ab84d2a0e4b3a2ad3c71e835 (patch)
tree2b3bfa1f74433c5252f96fdfc0f875c7c53ba39c /lib/axlsx
parent6a4b82def2e94b4811c38c37e606d426710d1e6c (diff)
downloadcaxlsx-5277073210c711a1ab84d2a0e4b3a2ad3c71e835.tar.gz
caxlsx-5277073210c711a1ab84d2a0e4b3a2ad3c71e835.zip
Fix sheet_by_name for sheets with escaped characters
Diffstat (limited to 'lib/axlsx')
-rw-r--r--lib/axlsx/workbook/workbook.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index 1a2f0488..da36e9a0 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -221,8 +221,8 @@ module Axlsx
# @param [String] name The name of the sheet you are looking for
# @return [Worksheet] The sheet found, or nil
def sheet_by_name(name)
- index = @worksheets.index { |sheet| sheet.name == name }
- @worksheets[index] if index
+ encoded_name = Axlsx.coder.encode(name)
+ @worksheets.find { |sheet| sheet.name == encoded_name }
end
# Creates a new Workbook.