lib/spoom/deadcode/plugins/active_model.rb in spoom-1.3.2 vs lib/spoom/deadcode/plugins/active_model.rb in spoom-1.3.3

- old
+ new

@@ -5,39 +5,39 @@ module Deadcode module Plugins class ActiveModel < Base extend T::Sig - ignore_classes_inheriting_from(/^(::)?ActiveModel::EachValidator$/) + ignore_classes_inheriting_from("ActiveModel::EachValidator") ignore_methods_named("validate_each") - sig { override.params(indexer: Indexer, send: Send).void } - def on_send(indexer, send) + sig { override.params(send: Send).void } + def on_send(send) return if send.recv case send.name when "attribute", "attributes" send.each_arg(Prism::SymbolNode) do |arg| - indexer.reference_method(arg.unescaped, send.node) + @index.reference_method(arg.unescaped, send.location) end when "validate", "validates", "validates!", "validates_each" send.each_arg(Prism::SymbolNode) do |arg| - indexer.reference_method(arg.unescaped, send.node) + @index.reference_method(arg.unescaped, send.location) end send.each_arg_assoc do |key, value| key = key.slice.delete_suffix(":") case key when "if", "unless" - indexer.reference_method(value.slice.delete_prefix(":"), send.node) if value + @index.reference_method(value.slice.delete_prefix(":"), send.location) if value else - indexer.reference_constant(camelize(key), send.node) + @index.reference_constant(camelize(key), send.location) end end when "validates_with" arg = send.args.first if arg.is_a?(Prism::SymbolNode) - indexer.reference_constant(arg.unescaped, send.node) + @index.reference_constant(arg.unescaped, send.location) end end end end end