Class: Spoom::Deadcode::Remover
- Inherits:
-
Object
- Object
- Spoom::Deadcode::Remover
- Extended by:
- T::Sig
- Defined in:
- lib/spoom/deadcode/remover.rb
Defined Under Namespace
Classes: Error, NodeContext, NodeFinder, NodeRemover
Instance Method Summary collapse
-
#initialize(context) ⇒ Remover
constructor
A new instance of Remover.
- #remove_location(kind, location) ⇒ Object
Constructor Details
#initialize(context) ⇒ Remover
Returns a new instance of Remover.
12 13 14 |
# File 'lib/spoom/deadcode/remover.rb', line 12 def initialize(context) @context = context end |
Instance Method Details
#remove_location(kind, location) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/spoom/deadcode/remover.rb', line 17 def remove_location(kind, location) file = location.file unless @context.file?(file) raise Error, "Can't find file at #{file}" end node_remover = NodeRemover.new(@context.read(file), kind, location) node_remover.apply_edit node_remover.new_source end |