diff options
| author | Geremia Taglialatela <[email protected]> | 2023-05-10 17:25:51 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-05-10 17:25:51 +0200 |
| commit | 7139d6252ad775ea9b6ffe2b2372e86c1c825401 (patch) | |
| tree | 1402fc2368cf9245459db84b1c6700ad0ce6f971 /lib/axlsx/stylesheet | |
| parent | 67d8a1a781e53761a483575cc5abc7e9a992d2ca (diff) | |
| download | caxlsx-7139d6252ad775ea9b6ffe2b2372e86c1c825401.tar.gz caxlsx-7139d6252ad775ea9b6ffe2b2372e86c1c825401.zip | |
Fix Inefficient Hash Search offenses
Use `key?` instead of `keys.include?` to improve performance
Diffstat (limited to 'lib/axlsx/stylesheet')
| -rw-r--r-- | lib/axlsx/stylesheet/styles.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 } |
