Class: Spoom::Deadcode::Plugins::Base

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/spoom/deadcode/plugins/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ignore_classes_inheriting_from(*names) ⇒ Object



52
53
54
# File 'lib/spoom/deadcode/plugins/base.rb', line 52

def ignore_classes_inheriting_from(*names)
  save_names_and_patterns(names, :@ignored_subclasses_of_names, :@ignored_subclasses_of_patterns)
end

.ignore_classes_named(*names) ⇒ Object



34
35
36
# File 'lib/spoom/deadcode/plugins/base.rb', line 34

def ignore_classes_named(*names)
  save_names_and_patterns(names, :@ignored_class_names, :@ignored_class_patterns)
end

.ignore_constants_named(*names) ⇒ Object



70
71
72
# File 'lib/spoom/deadcode/plugins/base.rb', line 70

def ignore_constants_named(*names)
  save_names_and_patterns(names, :@ignored_constant_names, :@ignored_constant_patterns)
end

.ignore_methods_named(*names) ⇒ Object



88
89
90
# File 'lib/spoom/deadcode/plugins/base.rb', line 88

def ignore_methods_named(*names)
  save_names_and_patterns(names, :@ignored_method_names, :@ignored_method_patterns)
end

.ignore_modules_named(*names) ⇒ Object



106
107
108
# File 'lib/spoom/deadcode/plugins/base.rb', line 106

def ignore_modules_named(*names)
  save_names_and_patterns(names, :@ignored_module_names, :@ignored_module_patterns)
end

Instance Method Details

#internal_on_define_accessor(indexer, definition) ⇒ Object



150
151
152
# File 'lib/spoom/deadcode/plugins/base.rb', line 150

def internal_on_define_accessor(indexer, definition)
  on_define_accessor(indexer, definition)
end

#internal_on_define_class(indexer, definition) ⇒ Object



174
175
176
177
178
179
180
181
182
# File 'lib/spoom/deadcode/plugins/base.rb', line 174

def internal_on_define_class(indexer, definition)
  if ignored_class_name?(definition.name)
    definition.ignored!
  elsif ignored_subclass?(indexer.nesting_class_superclass_name)
    definition.ignored!
  end

  on_define_class(indexer, definition)
end

#internal_on_define_constant(indexer, definition) ⇒ Object



204
205
206
207
208
# File 'lib/spoom/deadcode/plugins/base.rb', line 204

def internal_on_define_constant(indexer, definition)
  definition.ignored! if ignored_constant_name?(definition.name)

  on_define_constant(indexer, definition)
end

#internal_on_define_method(indexer, definition) ⇒ Object



232
233
234
235
236
# File 'lib/spoom/deadcode/plugins/base.rb', line 232

def internal_on_define_method(indexer, definition)
  definition.ignored! if ignored_method_name?(definition.name)

  on_define_method(indexer, definition)
end

#internal_on_define_module(indexer, definition) ⇒ Object



258
259
260
261
262
# File 'lib/spoom/deadcode/plugins/base.rb', line 258

def internal_on_define_module(indexer, definition)
  definition.ignored! if ignored_module_name?(definition.name)

  on_define_module(indexer, definition)
end

#internal_on_send(indexer, send) ⇒ Object



284
285
286
# File 'lib/spoom/deadcode/plugins/base.rb', line 284

def internal_on_send(indexer, send)
  on_send(indexer, send)
end

#on_define_accessor(indexer, definition) ⇒ Object



144
145
146
# File 'lib/spoom/deadcode/plugins/base.rb', line 144

def on_define_accessor(indexer, definition)
  # no-op
end

#on_define_class(indexer, definition) ⇒ Object



168
169
170
# File 'lib/spoom/deadcode/plugins/base.rb', line 168

def on_define_class(indexer, definition)
  # no-op
end

#on_define_constant(indexer, definition) ⇒ Object



198
199
200
# File 'lib/spoom/deadcode/plugins/base.rb', line 198

def on_define_constant(indexer, definition)
  # no-op
end

#on_define_method(indexer, definition) ⇒ Object



226
227
228
# File 'lib/spoom/deadcode/plugins/base.rb', line 226

def on_define_method(indexer, definition)
  # no-op
end

#on_define_module(indexer, definition) ⇒ Object



252
253
254
# File 'lib/spoom/deadcode/plugins/base.rb', line 252

def on_define_module(indexer, definition)
  # no-op
end

#on_send(indexer, send) ⇒ Object



278
279
280
# File 'lib/spoom/deadcode/plugins/base.rb', line 278

def on_send(indexer, send)
  # no-op
end