From ee14c1bf5c6aaa96867eb4b90b510f91c3a614f8 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 10 Jun 2023 11:48:13 +0200 Subject: Fix safe Style/ColonMethodCall offenses Caxlsx is using both `.` and `::`, 220 occurrences vs 280 to invoke methods on `Axlsx` module. This commit standardizes the approach towards `.`, which will also allow shorter lines. Performance is not affected ``` Comparison: Axlsx.validate: 8515252.3 i/s Axlsx::validate: 8512863.7 i/s - same-ish: difference falls within error ``` --- lib/axlsx/content_type/abstract_content_type.rb | 4 ++-- lib/axlsx/content_type/default.rb | 2 +- lib/axlsx/content_type/override.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/axlsx/content_type') diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb index 6aae8c4b..30ab9f35 100644 --- a/lib/axlsx/content_type/abstract_content_type.rb +++ b/lib/axlsx/content_type/abstract_content_type.rb @@ -18,7 +18,7 @@ module Axlsx # The content type. # @see Axlsx#validate_content_type - def content_type=(v) Axlsx::validate_content_type v; @content_type = v end + def content_type=(v) Axlsx.validate_content_type v; @content_type = v end alias :ContentType= :content_type= # Serialize the contenty type to xml @@ -26,7 +26,7 @@ module Axlsx str << '<' << node_name << ' ' Axlsx.instance_values_for(self).each_with_index do |key_value, index| str << ' ' unless index.zero? - str << Axlsx::camel(key_value.first) << '="' << key_value.last.to_s << '"' + str << Axlsx.camel(key_value.first) << '="' << key_value.last.to_s << '"' end str << '/>' end diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb index 16189fc6..2fbeb380 100644 --- a/lib/axlsx/content_type/default.rb +++ b/lib/axlsx/content_type/default.rb @@ -12,7 +12,7 @@ module Axlsx alias :Extension :extension # Sets the file extension for this content type. - def extension=(v) Axlsx::validate_string v; @extension = v end + def extension=(v) Axlsx.validate_string v; @extension = v end alias :Extension= :extension= # Serializes this object to xml diff --git a/lib/axlsx/content_type/override.rb b/lib/axlsx/content_type/override.rb index be45db3c..99db7546 100644 --- a/lib/axlsx/content_type/override.rb +++ b/lib/axlsx/content_type/override.rb @@ -12,7 +12,7 @@ module Axlsx alias :PartName :part_name # The name and location of the part. - def part_name=(v) Axlsx::validate_string v; @part_name = v end + def part_name=(v) Axlsx.validate_string v; @part_name = v end alias :PartName= :part_name= # Serializes this object to xml -- cgit v1.2.3