summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-27 18:55:25 +0200
committerGeremia Taglialatela <[email protected]>2023-05-31 09:41:47 +0200
commitd9b42a4da1d35e5741da67dfca7dfc9a73518787 (patch)
treeb50a13988274298233f249eee776d67a8629b154 /lib
parent8918a00eb0ff7b40240be5c94c4c245c95579acb (diff)
downloadcaxlsx-d9b42a4da1d35e5741da67dfca7dfc9a73518787.tar.gz
caxlsx-d9b42a4da1d35e5741da67dfca7dfc9a73518787.zip
Fix Style/ConditionalAssignment offenses
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/drawing/title.rb10
-rw-r--r--lib/axlsx/stylesheet/styles.rb12
-rw-r--r--lib/axlsx/workbook/workbook.rb10
-rw-r--r--lib/axlsx/workbook/worksheet/data_bar.rb10
4 files changed, 21 insertions, 21 deletions
diff --git a/lib/axlsx/drawing/title.rb b/lib/axlsx/drawing/title.rb
index 2e4037fb..84687a32 100644
--- a/lib/axlsx/drawing/title.rb
+++ b/lib/axlsx/drawing/title.rb
@@ -20,11 +20,11 @@ module Axlsx
def initialize(title = "", title_size = "")
self.cell = title if title.is_a?(Cell)
self.text = title.to_s unless title.is_a?(Cell)
- if title_size.to_s.empty?
- self.text_size = "1600"
- else
- self.text_size = title_size.to_s
- end
+ self.text_size = if title_size.to_s.empty?
+ "1600"
+ else
+ title_size.to_s
+ end
end
# @see text
diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb
index c3dd8d06..91055c96 100644
--- a/lib/axlsx/stylesheet/styles.rb
+++ b/lib/axlsx/stylesheet/styles.rb
@@ -265,12 +265,12 @@ module Axlsx
alignment = parse_alignment_options options
protection = parse_protection_options options
- case options[:type]
- when :dxf
- style = Dxf.new :fill => fill, :font => font, :numFmt => numFmt, :border => border, :alignment => alignment, :protection => protection
- else
- style = Xf.new :fillId => fill || 0, :fontId => font || 0, :numFmtId => numFmt || 0, :borderId => border || 0, :alignment => alignment, :protection => protection, :applyFill => !fill.nil?, :applyFont => !font.nil?, :applyNumberFormat => !numFmt.nil?, :applyBorder => !border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil?
- end
+ style = case options[:type]
+ when :dxf
+ Dxf.new :fill => fill, :font => font, :numFmt => numFmt, :border => border, :alignment => alignment, :protection => protection
+ else
+ Xf.new :fillId => fill || 0, :fontId => font || 0, :numFmtId => numFmt || 0, :borderId => border || 0, :alignment => alignment, :protection => protection, :applyFill => !fill.nil?, :applyFont => !font.nil?, :applyNumberFormat => !numFmt.nil?, :applyBorder => !border.nil?, :applyAlignment => !alignment.nil?, :applyProtection => !protection.nil?
+ end
if options[:type] == :xf
xf_index = (cellXfs << style)
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index ec80d6dc..79d6adbd 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -202,11 +202,11 @@ module Axlsx
styled_cells.each do |cell|
current_style = styles.style_index[cell.style]
- if current_style
- new_style = Axlsx.hash_deep_merge(current_style, cell.raw_style)
- else
- new_style = cell.raw_style
- end
+ new_style = if current_style
+ Axlsx.hash_deep_merge(current_style, cell.raw_style)
+ else
+ cell.raw_style
+ end
cell.style = styles.add_style(new_style)
end
diff --git a/lib/axlsx/workbook/worksheet/data_bar.rb b/lib/axlsx/workbook/worksheet/data_bar.rb
index 482bd029..27218423 100644
--- a/lib/axlsx/workbook/worksheet/data_bar.rb
+++ b/lib/axlsx/workbook/worksheet/data_bar.rb
@@ -117,11 +117,11 @@ module Axlsx
def initialize_cfvos(cfvos)
self.class.default_cfvos.each_with_index.map do |default, index|
- if index < cfvos.size
- value_objects << Cfvo.new(default.merge(cfvos[index]))
- else
- value_objects << Cfvo.new(default)
- end
+ value_objects << if index < cfvos.size
+ Cfvo.new(default.merge(cfvos[index]))
+ else
+ Cfvo.new(default)
+ end
end
end
end