diff options
| -rw-r--r-- | .rubocop_todo.yml | 11 | ||||
| -rw-r--r-- | lib/axlsx/drawing/drawing.rb | 4 | ||||
| -rw-r--r-- | lib/axlsx/stylesheet/styles.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/workbook.rb | 4 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb | 2 |
6 files changed, 7 insertions, 18 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ae3b1d2a..8048c1b4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -455,17 +455,6 @@ Style/StringLiterals: Style/SymbolArray: EnforcedStyle: brackets -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. -# AllowedMethods: define_method -Style/SymbolProc: - Exclude: - - 'lib/axlsx/drawing/drawing.rb' - - 'lib/axlsx/stylesheet/styles.rb' - - 'lib/axlsx/workbook/workbook.rb' - - 'lib/axlsx/workbook/worksheet/worksheet.rb' - - 'lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, AllowSafeAssignment. # SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 8cb3e2cc..fa7a608c 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -109,14 +109,14 @@ module Axlsx # @return [Array] def hyperlinks links = self.images.select { |a| a.hyperlink.is_a?(Hyperlink) } - links.map { |a| a.hyperlink } + links.map(&:hyperlink) end # An array of image objects that are associated with this drawing's anchors # @return [Array] def images images = @anchors.select { |a| a.object.is_a?(Pic) } - images.map { |a| a.object } + images.map(&:object) end # The index of this drawing in the owning workbooks's drawings collection. 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 diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index ec80d6dc..2c6e0491 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -171,7 +171,7 @@ module Axlsx # @see Comment # @return [Comments] def comments - worksheets.map { |sheet| sheet.comments }.compact + worksheets.map(&:comments).compact end # The styles associated with this workbook @@ -369,7 +369,7 @@ module Axlsx # generates a shared string object against all cells in all worksheets. # @return [SharedStringTable] def shared_strings - SharedStringsTable.new(worksheets.collect { |ws| ws.cells }, xml_space) + SharedStringsTable.new(worksheets.collect(&:cells), xml_space) end # The xml:space attribute for the worksheet. diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index aaeadb11..1ece3138 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -760,7 +760,7 @@ module Axlsx raise ArgumentError, (ERR_SHEET_NAME_CHARACTER_FORBIDDEN % name) if WORKSHEET_NAME_FORBIDDEN_CHARS.any? { |char| name.include? char } name = Axlsx::coder.encode(name) - sheet_names = @workbook.worksheets.reject { |s| s == self }.map { |s| s.name } + sheet_names = @workbook.worksheets.reject { |s| s == self }.map(&:name) raise ArgumentError, (ERR_DUPLICATE_SHEET_NAME % name) if sheet_names.include?(name) end diff --git a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb index f19630f8..334b59da 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb @@ -24,7 +24,7 @@ module Axlsx def relationships return [] if empty? - map { |hyperlink| hyperlink.relationship } + map(&:relationship) end # seralize the collection of hyperlinks |
