Sha256: c121a05a225a123844625ecbf7cd15787c0a9e1b45623a03c9da8d13069a9f16

Contents?: true

Size: 732 Bytes

Versions: 5

Compression:

Stored size: 732 Bytes

Contents

# typed: strict
# frozen_string_literal: true

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

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

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

        private

        sig { params(symbol_def: Model::Namespace).returns(T::Boolean) }
        def used_as_namespace?(symbol_def)
          symbol_def.children.any?
        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/namespaces.rb
spoom-1.4.2 lib/spoom/deadcode/plugins/namespaces.rb
spoom-1.4.1 lib/spoom/deadcode/plugins/namespaces.rb
spoom-1.4.0 lib/spoom/deadcode/plugins/namespaces.rb
spoom-1.3.3 lib/spoom/deadcode/plugins/namespaces.rb