Sha256: cac9059a6f95fb8ccde350ddb53a40faa7aac842b3add4b560d7a415d313b93a

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Spoom
  module Deadcode
    module Plugins
      class Rails < Base
        extend T::Sig

        ignore_constants_named("APP_PATH", "ENGINE_PATH", "ENGINE_ROOT")

        sig { override.params(definition: Model::Class).void }
        def on_define_class(definition)
          @index.ignore(definition) if file_is_helper?(definition)
        end

        sig { override.params(definition: Model::Module).void }
        def on_define_module(definition)
          @index.ignore(definition) if file_is_helper?(definition)
        end

        private

        sig { params(symbol_def: Model::Namespace).returns(T::Boolean) }
        def file_is_helper?(symbol_def)
          symbol_def.location.file.match?(%r{app/helpers/.*\.rb$})
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spoom-1.5.0 lib/spoom/deadcode/plugins/rails.rb
spoom-1.4.2 lib/spoom/deadcode/plugins/rails.rb
spoom-1.4.1 lib/spoom/deadcode/plugins/rails.rb
spoom-1.4.0 lib/spoom/deadcode/plugins/rails.rb
spoom-1.3.3 lib/spoom/deadcode/plugins/rails.rb