Sha256: a396a1e71a58f54e0c8f66be451b58213424a55e607b7f20a726b953df4b7439

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 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(indexer: Indexer, definition: Definition).void }
        def on_define_class(indexer, definition)
          definition.ignored! if file_is_helper?(indexer)
        end

        sig { override.params(indexer: Indexer, definition: Definition).void }
        def on_define_module(indexer, definition)
          definition.ignored! if file_is_helper?(indexer)
        end

        private

        sig { params(indexer: Indexer).returns(T::Boolean) }
        def file_is_helper?(indexer)
          indexer.path.match?(%r{app/helpers/.*\.rb$})
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spoom-1.3.2 lib/spoom/deadcode/plugins/rails.rb
spoom-1.3.1 lib/spoom/deadcode/plugins/rails.rb
spoom-1.3.0 lib/spoom/deadcode/plugins/rails.rb
spoom-1.2.4 lib/spoom/deadcode/plugins/rails.rb