summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-31 17:31:59 +0200
committerGeremia Taglialatela <[email protected]>2023-05-31 17:31:59 +0200
commit4e555613a021639c12be713c438bb124622c72d3 (patch)
treee629fb11f494e85fa1e6205792111b83474d45d9 /lib/axlsx/workbook/worksheet
parentad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd (diff)
downloadcaxlsx-4e555613a021639c12be713c438bb124622c72d3.tar.gz
caxlsx-4e555613a021639c12be713c438bb124622c72d3.zip
Remove redundant parentheses
- Style/ParenthesesAroundCondition - Style/RedundantParentheses - Style/TernaryParentheses `Style/ParenthesesAroundCondition` may be questionable, but a majority of comparison where not using parentheses, so offenses have been fixed for uniformity across the codebase
Diffstat (limited to 'lib/axlsx/workbook/worksheet')
-rw-r--r--lib/axlsx/workbook/worksheet/pivot_table.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/rich_text_run.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/axlsx/workbook/worksheet/pivot_table.rb b/lib/axlsx/workbook/worksheet/pivot_table.rb
index a75842cd..aca3ccb5 100644
--- a/lib/axlsx/workbook/worksheet/pivot_table.rb
+++ b/lib/axlsx/workbook/worksheet/pivot_table.rb
@@ -245,7 +245,7 @@ module Axlsx
str << "<dataFields count=\"#{data.size}\">"
data.each do |datum_value|
# The correct name prefix in ["Sum","Average", etc...]
- str << "<dataField name='#{(datum_value[:subtotal] || '')} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
+ str << "<dataField name='#{datum_value[:subtotal] || ''} of #{datum_value[:ref]}' fld='#{header_index_of(datum_value[:ref])}' baseField='0' baseItem='0'"
str << " numFmtId='#{datum_value[:num_fmt]}'" if datum_value[:num_fmt]
str << " subtotal='#{datum_value[:subtotal]}' " if datum_value[:subtotal]
str << "/>"
diff --git a/lib/axlsx/workbook/worksheet/rich_text_run.rb b/lib/axlsx/workbook/worksheet/rich_text_run.rb
index 9f66959a..dac27752 100644
--- a/lib/axlsx/workbook/worksheet/rich_text_run.rb
+++ b/lib/axlsx/workbook/worksheet/rich_text_run.rb
@@ -130,7 +130,7 @@ module Axlsx
# @see u
def u=(v)
- v = :single if (v == true || v == 1 || v == :true || v == 'true')
+ v = :single if v == true || v == 1 || v == :true || v == 'true'
set_run_style :validate_cell_u, :u, v
end
@@ -242,7 +242,7 @@ module Axlsx
return sz if sz
font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]
- (font.b || (defined?(@b) && @b)) ? (font.sz * 1.5) : font.sz
+ font.b || (defined?(@b) && @b) ? (font.sz * 1.5) : font.sz
end
def style
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 90461c66..f2587edb 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -753,7 +753,7 @@ module Axlsx
def validate_sheet_name(name)
DataTypeValidator.validate :worksheet_name, String, name
# ignore first character (BOM) after encoding to utf16 because Excel does so, too.
- raise ArgumentError, (ERR_SHEET_NAME_EMPTY) if name.empty?
+ raise ArgumentError, ERR_SHEET_NAME_EMPTY if name.empty?
character_length = name.encode("utf-16")[1..-1].encode("utf-16").bytesize / 2
raise ArgumentError, (ERR_SHEET_NAME_TOO_LONG % name) if character_length > WORKSHEET_MAX_NAME_LENGTH