From 1fe076ba0d3232a0784f16321580b9a65953ec87 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Sun, 17 Dec 2023 08:54:45 +0100 Subject: [PATCH] fix rubopcop offenses Performance/StringIdentifierArgument --- app/helpers/additionals_journals_helper.rb | 6 +++--- app/helpers/additionals_queries_helper.rb | 2 +- app/helpers/dashboards_helper.rb | 2 +- lib/additionals/helpers.rb | 4 ++-- test/global_test_helper.rb | 8 +++----- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/helpers/additionals_journals_helper.rb b/app/helpers/additionals_journals_helper.rb index b9cc39f8..dac01fde 100644 --- a/app/helpers/additionals_journals_helper.rb +++ b/app/helpers/additionals_journals_helper.rb @@ -51,13 +51,13 @@ module AdditionalsJournalsHelper entity_type = entity.model_name.param_key safe_join [link_to(l(:button_edit), - send("edit_#{entity_type}_journal_path", journal), + send(:"edit_#{entity_type}_journal_path", journal), remote: true, method: 'get', title: l(:button_edit), class: 'icon-only icon-edit'), link_to(l(:button_delete), - send("#{entity_type}_journal_path", journal, journal: { notes: '' }), + send(:"#{entity_type}_journal_path", journal, journal: { notes: '' }), remote: true, method: 'put', data: { confirm: l(:text_are_you_sure) }, title: l(:button_delete), @@ -123,7 +123,7 @@ module AdditionalsJournalsHelper # rubocop: enable Style/OptionalBooleanParameter def render_email_attributes(entry, html: false) - items = send "email_#{entry.class.name.underscore}_attributes", entry, html + items = send :"email_#{entry.class.name.underscore}_attributes", entry, html if html tag.ul class: 'details' do items.map { |s| concat tag.li(s) }.join("\n") diff --git a/app/helpers/additionals_queries_helper.rb b/app/helpers/additionals_queries_helper.rb index 1b1cad42..02880f67 100644 --- a/app/helpers/additionals_queries_helper.rb +++ b/app/helpers/additionals_queries_helper.rb @@ -23,7 +23,7 @@ module AdditionalsQueriesHelper def additionals_retrieve_query(object_type, user_filter: nil, search_string: nil) session_key = additionals_query_session_key object_type - query_class = Object.const_get "#{object_type.camelcase}Query" + query_class = Object.const_get :"#{object_type.camelcase}Query" if params[:query_id].present? additionals_load_query_id query_class, session_key, diff --git a/app/helpers/dashboards_helper.rb b/app/helpers/dashboards_helper.rb index 2b67abd2..3f97243d 100644 --- a/app/helpers/dashboards_helper.rb +++ b/app/helpers/dashboards_helper.rb @@ -471,7 +471,7 @@ module DashboardsHelper nil end else - send "render_#{block_definition[:name]}_block", + send :"render_#{block_definition[:name]}_block", block, block_definition, settings, diff --git a/lib/additionals/helpers.rb b/lib/additionals/helpers.rb index f7ca715e..01ac19f4 100644 --- a/lib/additionals/helpers.rb +++ b/lib/additionals/helpers.rb @@ -110,7 +110,7 @@ module Additionals def additionals_library_load(module_names) s = [] Array(module_names).each do |module_name| - s << send("additionals_load_#{module_name}") + s << send(:"additionals_load_#{module_name}") end safe_join s end @@ -147,7 +147,7 @@ module Additionals partial: 'additionals/select2_ajax_call', formats: [:js], locals: { field_name_id: sanitize_to_id(name), - ajax_url: send("#{type}_path", ajax_params), + ajax_url: send(:"#{type}_path", ajax_params), options: options }) safe_join s end diff --git a/test/global_test_helper.rb b/test/global_test_helper.rb index afdbda6a..e2203aa7 100644 --- a/test/global_test_helper.rb +++ b/test/global_test_helper.rb @@ -129,20 +129,18 @@ module Additionals end def change_plugin_settings(plugin, settings) - instance_variable_set "@saved_#{plugin}_settings", Setting.send("plugin_#{plugin}").dup - new_settings = Setting.send("plugin_#{plugin}").dup + instance_variable_set :"@saved_#{plugin}_settings", Setting.send(:"plugin_#{plugin}").dup + new_settings = Setting.send(:"plugin_#{plugin}").dup settings.each do |key, value| new_settings[key] = value end - Setting.send "plugin_#{plugin}=", new_settings Setting.send :"plugin_#{plugin}=", new_settings end def restore_plugin_settings(plugin) - settings = instance_variable_get "@saved_#{plugin}_settings" + settings = instance_variable_get :"@saved_#{plugin}_settings" if settings - Setting.send "plugin_#{plugin}=", settings Setting.send :"plugin_#{plugin}=", settings else Rails.logger.warn "warning: restore_plugin_settings could not restore settings for #{plugin}"