Class: NodeMutation::RemoveAction

Inherits:
Action
  • Object
show all
Defined in:
lib/node_mutation/action/remove_action.rb

Overview

RemoveAction to remove current node.

Instance Attribute Summary

Attributes inherited from Action

#actions, #end, #start, #type

Instance Method Summary collapse

Methods inherited from Action

#process, #to_struct

Constructor Details

#initialize(node, adapter:, and_comma: false) ⇒ RemoveAction

Initialize a RemoveAction.

Parameters:

  • node (Node)
  • and_comma (Boolean) (defaults to: false)

    delete extra comma.

  • adapter (NodeMutation::Adapter)


10
11
12
13
14
# File 'lib/node_mutation/action/remove_action.rb', line 10

def initialize(node, adapter:, and_comma: false)
  super(node, nil, adapter: adapter)
  @and_comma = and_comma
  @type = :delete
end

Instance Method Details

#new_codeObject

The rewritten code, always empty string.



17
18
19
# File 'lib/node_mutation/action/remove_action.rb', line 17

def new_code
  ''
end