Style/SendWithLiteralMethodName

Use method call directly instead of `public_send` with fixed argument.

The cop is declared unsafe. I think that is because it can also replace
`send` but we replace only `public_send` here.
This commit is contained in:
Maikel Linke
2024-06-05 09:33:41 +10:00
committed by zanetagebka
parent 8b4759ee05
commit 5925b023b3
4 changed files with 6 additions and 6 deletions

View File

@@ -146,7 +146,7 @@ module Admin
return nil if parent_data.blank?
@parent ||= parent_data[:model_class].
public_send("find_by", parent_data[:find_by] => params["#{model_name}_id"])
find_by(parent_data[:find_by] => params["#{model_name}_id"])
instance_variable_set("@#{model_name}", @parent)
end

View File

@@ -15,7 +15,7 @@ module Reporting
end
def selecting(lambda)
fields = instance_exec(&lambda).map{ |key, value| value.public_send(:as, key.to_s) }
fields = instance_exec(&lambda).map{ |key, value| value.as(key.to_s) }
reflect query.project(*fields)
end

View File

@@ -3,9 +3,9 @@
module Spree
module AuthenticationHelpers
def self.included(receiver)
receiver.public_send :helper_method, :spree_current_user
receiver.public_send :helper_method, :spree_login_path
receiver.public_send :helper_method, :spree_logout_path
receiver.helper_method :spree_current_user
receiver.helper_method :spree_login_path
receiver.helper_method :spree_logout_path
end
def spree_current_user

View File

@@ -75,7 +75,7 @@ end
module RswagExtension
def param(args, &)
public_send(:let, args) { instance_eval(&) }
let(args) { instance_eval(&) }
end
end
Rswag::Specs::ExampleGroupHelpers.prepend RswagExtension