summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-06-02 20:55:14 +0200
committerGeremia Taglialatela <[email protected]>2023-06-02 20:55:14 +0200
commit4195130bb4633bc667aeedd297dc56d7632a5810 (patch)
tree58a96dd864cc81c66c14499b6b6de40dbcd1d936 /lib/axlsx/drawing
parentad87c51bf8c8f59a36514bb95dc6d3a582c6b2fd (diff)
downloadcaxlsx-4195130bb4633bc667aeedd297dc56d7632a5810.tar.gz
caxlsx-4195130bb4633bc667aeedd297dc56d7632a5810.zip
Fix negated if offenses
Should also provide a negligible performance improvement, about 3% on Ruby 3.2 and 6% on Ruby 2.6 (M1 Pro)
Diffstat (limited to 'lib/axlsx/drawing')
-rw-r--r--lib/axlsx/drawing/num_val.rb2
-rw-r--r--lib/axlsx/drawing/str_val.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/axlsx/drawing/num_val.rb b/lib/axlsx/drawing/num_val.rb
index 19829a30..862d22ae 100644
--- a/lib/axlsx/drawing/num_val.rb
+++ b/lib/axlsx/drawing/num_val.rb
@@ -25,7 +25,7 @@ module Axlsx
# serialize the object
def to_xml_string(idx, str = +'')
Axlsx::validate_unsigned_int(idx)
- if !v.to_s.empty?
+ unless v.to_s.empty?
str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>'
end
end
diff --git a/lib/axlsx/drawing/str_val.rb b/lib/axlsx/drawing/str_val.rb
index d09e6ce8..86663cec 100644
--- a/lib/axlsx/drawing/str_val.rb
+++ b/lib/axlsx/drawing/str_val.rb
@@ -25,7 +25,7 @@ module Axlsx
# serialize the object
def to_xml_string(idx, str = +'')
Axlsx::validate_unsigned_int(idx)
- if !v.to_s.empty?
+ unless v.to_s.empty?
str << '<c:pt idx="' << idx.to_s << '"><c:v>' << ::CGI.escapeHTML(v.to_s) << '</c:v></c:pt>'
end
end