Adapter — Documentation by YARD 0.9.38

Class: NodeMutation::Adapter

Inherits:
Object
  • Object
  • NodeMutation::Adapter
show all
Defined in:
lib/node_mutation/adapter.rb

Constant Summary collapse

INDEX_REGEXP =
/\A-?\d+\z/

Instance Method Summary collapse

Instance Method Details

#child_node_range(node, child_name) ⇒ { start: Number, end: Number }

Get the start/end range of the child node


34
35
36
# File 'lib/node_mutation/adapter.rb', line 34

def child_node_range(node, child_name)
  raise NotImplementedError, "child_node_range is not implemented"
end

#file_source(node) ⇒ Object

The file content of the ast node file


26
27
28
# File 'lib/node_mutation/adapter.rb', line 26

def file_source(node)
  raise NotImplementedError, "file_source is not implemented"
end

#get_end(node, child_name = nil) ⇒ Number

Get end position of ast node


50
51
52
# File 'lib/node_mutation/adapter.rb', line 50

def get_end(node, child_name = nil)
  raise NotImplementedError, "get_end is not implemented"
end

#get_end_loc(node, child_name = nil) ⇒ { line: Number, column: Number }

Get end location of ast node


66
67
68
# File 'lib/node_mutation/adapter.rb', line 66

def get_end_loc(node, child_name = nil)
  raise NotImplementedError, "get_end_loc is not implemented"
end

#get_source(node) ⇒ String

Get source code of the ast node


9
10
11
# File 'lib/node_mutation/adapter.rb', line 9

def get_source(node)
  raise NotImplementedError, "get_source is not implemented"
end

#get_start(node, child_name = nil) ⇒ Number

Get start position of ast node


42
43
44
# File 'lib/node_mutation/adapter.rb', line 42

def get_start(node, child_name = nil)
  raise NotImplementedError, "get_start is not implemented"
end

#get_start_loc(node, child_name = nil) ⇒ { line: Number, column: Number }

Get start location of ast node


58
59
60
# File 'lib/node_mutation/adapter.rb', line 58

def get_start_loc(node, child_name = nil)
  raise NotImplementedError, "get_start_loc is not implemented"
end

#rewritten_source(node, code) ⇒ String

Replace the child node selector with child node source code it will return ‘Boolean(foobar)`


19
20
21
# File 'lib/node_mutation/adapter.rb', line 19

def rewritten_source(node, code)
  raise NotImplementedError, "rewritten_source is not implemented"
end