summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.rubocop_todo.yml7
-rw-r--r--lib/axlsx/workbook/workbook.rb4
2 files changed, 2 insertions, 9 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 2385ecb2..846974f6 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -106,11 +106,6 @@ Performance/CollectionLiteralInLoop:
- 'lib/axlsx/package.rb'
- 'lib/axlsx/workbook/worksheet/page_margins.rb'
-# This cop supports unsafe autocorrection (--autocorrect-all).
-Performance/Detect:
- Exclude:
- - 'lib/axlsx/workbook/workbook.rb'
-
# This cop supports safe autocorrection (--autocorrect).
Performance/RedundantBlockCall:
Exclude:
@@ -121,7 +116,6 @@ Performance/RedundantMatch:
Exclude:
- 'lib/axlsx.rb'
- 'lib/axlsx/stylesheet/color.rb'
- - 'lib/axlsx/workbook/workbook.rb'
# This cop supports safe autocorrection (--autocorrect).
Performance/RedundantSplitRegexpArgument:
@@ -132,7 +126,6 @@ Performance/RedundantSplitRegexpArgument:
Performance/RegexpMatch:
Exclude:
- 'lib/axlsx/stylesheet/color.rb'
- - 'lib/axlsx/workbook/workbook.rb'
- 'lib/axlsx/workbook/worksheet/cell.rb'
# This cop supports safe autocorrection (--autocorrect).
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index 3e4927aa..1a2f0488 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -395,8 +395,8 @@ module Axlsx
# retrieve the cells from. e.g. range('Sheet1!A1:B2') will return an array of four cells [A1, A2, B1, B2] while range('Sheet1!A1') will return a single Cell.
# @return [Cell, Array]
def [](cell_def)
- sheet_name = cell_def.split('!')[0] if cell_def.match('!')
- worksheet = self.worksheets.select { |s| s.name == sheet_name }.first
+ sheet_name = cell_def.split('!')[0] if cell_def.include?('!')
+ worksheet = self.worksheets.find { |s| s.name == sheet_name }
raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)
worksheet[cell_def.gsub(/.+!/, "")]