summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/worksheet.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-06-10 11:48:13 +0200
committerGeremia Taglialatela <[email protected]>2023-06-10 11:48:13 +0200
commitee14c1bf5c6aaa96867eb4b90b510f91c3a614f8 (patch)
tree63a893a73f1cc51003edf218fed178bb93c604d7 /lib/axlsx/workbook/worksheet/worksheet.rb
parentcfb516062de3d0725b3245cc328f96d702d662d3 (diff)
downloadcaxlsx-ee14c1bf5c6aaa96867eb4b90b510f91c3a614f8.tar.gz
caxlsx-ee14c1bf5c6aaa96867eb4b90b510f91c3a614f8.zip
Fix safe Style/ColonMethodCall offenses
Caxlsx is using both `.` and `::`, 220 occurrences vs 280 to invoke methods on `Axlsx` module. This commit standardizes the approach towards `.`, which will also allow shorter lines. Performance is not affected ``` Comparison: Axlsx.validate: 8515252.3 i/s Axlsx::validate: 8512863.7 i/s - same-ish: difference falls within error ```
Diffstat (limited to 'lib/axlsx/workbook/worksheet/worksheet.rb')
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index e3e409af..47373d75 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -327,7 +327,7 @@ module Axlsx
# @param [String] name
def name=(name)
validate_sheet_name name
- @name = Axlsx::coder.encode(name)
+ @name = Axlsx.coder.encode(name)
end
# The auto filter range for the worksheet
@@ -547,7 +547,7 @@ module Axlsx
widths.each_with_index do |value, index|
next if value.nil?
- Axlsx::validate_unsigned_numeric(value) unless value.nil?
+ Axlsx.validate_unsigned_numeric(value) unless value.nil?
find_or_create_column_info(index).width = value
end
end
@@ -688,7 +688,7 @@ module Axlsx
# @param [String] name The cell or cell range to return. "A1" will return the first cell of the first row.
# @return [Cell]
def name_to_cell(name)
- col_index, row_index = *Axlsx::name_to_indices(name)
+ col_index, row_index = *Axlsx.name_to_indices(name)
r = rows[row_index]
@@ -759,7 +759,7 @@ module Axlsx
raise ArgumentError, format(ERR_SHEET_NAME_TOO_LONG, name) if character_length > WORKSHEET_MAX_NAME_LENGTH
raise ArgumentError, format(ERR_SHEET_NAME_CHARACTER_FORBIDDEN, name) if WORKSHEET_NAME_FORBIDDEN_CHARS.any? { |char| name.include? char }
- name = Axlsx::coder.encode(name)
+ name = Axlsx.coder.encode(name)
sheet_names = @workbook.worksheets.reject { |s| s == self }.map(&:name)
raise ArgumentError, format(ERR_DUPLICATE_SHEET_NAME, name) if sheet_names.include?(name)
end