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

#end, #start

Instance Method Summary collapse

Methods inherited from Action

#process

Constructor Details

#initialize(node, and_comma: false) ⇒ RemoveAction

Initialize a RemoveAction.

Parameters:

  • node (Node)
  • options (Hash)

    options.

  • and_comma (Hash) (defaults to: false)

    a customizable set of options

Options Hash (and_comma:):

  • delete (Boolean)

    extra comma.



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

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

Instance Method Details

#new_codeObject

The rewritten code, always empty string.



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

def new_code
  ''
end