summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorZsolt Kozaroczy <[email protected]>2023-05-15 12:01:29 +0200
committerGitHub <[email protected]>2023-05-15 12:01:29 +0200
commit3b9ac17d8e4dc8b315ac307ffad6f2aa0cb96741 (patch)
treec26eb948513970266af355afa4815d4d778ff47e /lib
parent1e749086b255beb862e88505f347ff9e29e6ce40 (diff)
parent7139d6252ad775ea9b6ffe2b2372e86c1c825401 (diff)
downloadcaxlsx-3b9ac17d8e4dc8b315ac307ffad6f2aa0cb96741.tar.gz
caxlsx-3b9ac17d8e4dc8b315ac307ffad6f2aa0cb96741.zip
Merge pull request #224 from tagliala/chore/fix-inefficient-hash-search
Fix Inefficient Hash Search offenses
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/drawing/axes.rb2
-rw-r--r--lib/axlsx/drawing/d_lbls.rb2
-rw-r--r--lib/axlsx/stylesheet/styles.rb4
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb
index eb4728c6..6a74c879 100644
--- a/lib/axlsx/drawing/axes.rb
+++ b/lib/axlsx/drawing/axes.rb
@@ -9,7 +9,7 @@ module Axlsx
# class of the axis type to construct. The :cat_axis, if there is one,
# must come first (we assume a Ruby 1.9+ Hash or an OrderedHash).
def initialize(options = {})
- raise(ArgumentError, "CatAxis must come first") if options.keys.include?(:cat_axis) && options.keys.first != :cat_axis
+ raise(ArgumentError, "CatAxis must come first") if options.key?(:cat_axis) && options.keys.first != :cat_axis
options.each do |name, axis_class|
add_axis(name, axis_class)
diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb
index 4e2bd40c..29697378 100644
--- a/lib/axlsx/drawing/d_lbls.rb
+++ b/lib/axlsx/drawing/d_lbls.rb
@@ -76,7 +76,7 @@ module Axlsx
str << '<c:dLbls>'
instance_vals = Axlsx.instance_values_for(self)
%w(d_lbl_pos show_legend_key show_val show_cat_name show_ser_name show_percent show_bubble_size show_leader_lines).each do |key|
- next unless instance_vals.keys.include?(key) && instance_vals[key] != nil
+ next unless instance_vals.key?(key) && instance_vals[key] != nil
str << "<c:#{Axlsx::camel(key, false)} val='#{instance_vals[key]}' />"
end
diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb
index 7b44c023..e8263b45 100644
--- a/lib/axlsx/stylesheet/styles.rb
+++ b/lib/axlsx/stylesheet/styles.rb
@@ -329,7 +329,7 @@ module Axlsx
Axlsx.instance_values_for(fonts.first).each do |key, value|
# Thanks for that 1.8.7 - cant do a simple merge...
- options[key.to_sym] = value unless options.keys.include?(key.to_sym)
+ options[key.to_sym] = value unless options.key?(key.to_sym)
end
font = Font.new(options)
font.color = Color.new(:rgb => options[:fg_color]) if options[:fg_color]
@@ -383,7 +383,7 @@ module Axlsx
end
validate_border_hash = ->(val) {
- if !(val.keys.include?(:style) && val.keys.include?(:color))
+ if !(val.key?(:style) && val.key?(:color))
raise ArgumentError, (ERR_INVALID_BORDER_OPTIONS % options[:border])
end
}
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index 8c3514cc..960f33b3 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -187,7 +187,7 @@ module Axlsx
# @return Boolean
# @see #page_setup
def fit_to_page?
- return false unless Axlsx.instance_values_for(self).keys.include?('page_setup')
+ return false unless Axlsx.instance_values_for(self).key?('page_setup')
page_setup.fit_to_page?
end