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

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ Base

Returns a new instance of Base.



132
133
134
# File 'lib/spoom/deadcode/plugins/base.rb', line 132

def initialize(index)
  @index = index
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



129
130
131
# File 'lib/spoom/deadcode/plugins/base.rb', line 129

def index
  @index
end

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(definition) ⇒ Object



158
159
160
# File 'lib/spoom/deadcode/plugins/base.rb', line 158

def internal_on_define_accessor(definition)
  on_define_accessor(definition)
end

#internal_on_define_class(definition) ⇒ Object



182
183
184
185
186
187
188
189
190
# File 'lib/spoom/deadcode/plugins/base.rb', line 182

def internal_on_define_class(definition)
  if ignored_class_name?(definition.name)
    @index.ignore(definition)
  elsif ignored_subclass?(definition)
    @index.ignore(definition)
  end

  on_define_class(definition)
end

#internal_on_define_constant(definition) ⇒ Object



212
213
214
215
216
# File 'lib/spoom/deadcode/plugins/base.rb', line 212

def internal_on_define_constant(definition)
  @index.ignore(definition) if ignored_constant_name?(definition.name)

  on_define_constant(definition)
end

#internal_on_define_method(definition) ⇒ Object



238
239
240
241
242
# File 'lib/spoom/deadcode/plugins/base.rb', line 238

def internal_on_define_method(definition)
  @index.ignore(definition) if ignored_method_name?(definition.name)

  on_define_method(definition)
end

#internal_on_define_module(definition) ⇒ Object



264
265
266
267
268
# File 'lib/spoom/deadcode/plugins/base.rb', line 264

def internal_on_define_module(definition)
  @index.ignore(definition) if ignored_module_name?(definition.name)

  on_define_module(definition)
end

#on_define_accessor(definition) ⇒ Object



152
153
154
# File 'lib/spoom/deadcode/plugins/base.rb', line 152

def on_define_accessor(definition)
  # no-op
end

#on_define_class(definition) ⇒ Object



176
177
178
# File 'lib/spoom/deadcode/plugins/base.rb', line 176

def on_define_class(definition)
  # no-op
end

#on_define_constant(definition) ⇒ Object



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

def on_define_constant(definition)
  # no-op
end

#on_define_method(definition) ⇒ Object



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

def on_define_method(definition)
  # no-op
end

#on_define_module(definition) ⇒ Object



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

def on_define_module(definition)
  # no-op
end

#on_send(send) ⇒ Object



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

def on_send(send)
  # no-op
end