Sha256: f50062cc57a4e79ff12072444a9aa663f061921f300cc71281ff54749d391900
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 KB
Contents
# typed: strict # frozen_string_literal: true module Spoom module Deadcode module Plugins class ActionPack < Base extend T::Sig CALLBACKS = T.let( [ "after_action", "append_after_action", "append_around_action", "append_before_action", "around_action", "before_action", "prepend_after_action", "prepend_around_action", "prepend_before_action", "skip_after_action", "skip_around_action", "skip_before_action", ].freeze, T::Array[String], ) ignore_classes_named(/Controller$/) sig { override.params(indexer: Indexer, definition: Definition).void } def on_define_method(indexer, definition) definition.ignored! if ignored_class_name?(indexer.nesting_class_name) end sig { override.params(indexer: Indexer, send: Send).void } def on_send(indexer, send) return unless send.recv.nil? && CALLBACKS.include?(send.name) arg = send.args.first case arg when Prism::SymbolNode indexer.reference_method(arg.unescaped, send.node) 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 else indexer.reference_constant(camelize(key), send.node) end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spoom-1.3.2 | lib/spoom/deadcode/plugins/actionpack.rb |
spoom-1.3.1 | lib/spoom/deadcode/plugins/actionpack.rb |
spoom-1.3.0 | lib/spoom/deadcode/plugins/actionpack.rb |