Class: NodeMutation::Adapter
- Inherits:
-
Object
- Object
- NodeMutation::Adapter
- Defined in:
- lib/node_mutation/adapter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#child_node_range(node, child_name) ⇒ { start: Number, end: Number }
Get the start/end range of the child node.
-
#file_content(node) ⇒ Object
The file content of the ast node file.
-
#get_end(node) ⇒ Number
Get end position of ast node.
-
#get_end_loc(node) ⇒ { line: Number, column: Number }
Get end location of ast node.
-
#get_indent(node) ⇒ Number
Get indent of ast node.
-
#get_source(node) ⇒ String
Get source code of the ast node.
-
#get_start(node) ⇒ Number
Get start position of ast node.
-
#get_start_loc(node) ⇒ { line: Number, column: Number }
Get start location of ast node.
-
#rewritten_source(node, code) ⇒ String
Replace the child node selector with child node source code it will return ‘Boolean(foobar)`.
Instance Method Details
#child_node_range(node, child_name) ⇒ { start: Number, end: Number }
Get the start/end range of the child node
32 33 34 |
# File 'lib/node_mutation/adapter.rb', line 32 def child_node_range(node, child_name) raise NotImplementedError, "child_node_range is not implemented" end |
#file_content(node) ⇒ Object
The file content of the ast node file
24 25 26 |
# File 'lib/node_mutation/adapter.rb', line 24 def file_content(node) raise NotImplementedError, "file_content is not implemented" end |
#get_end(node) ⇒ Number
Get end position of ast node
46 47 48 |
# File 'lib/node_mutation/adapter.rb', line 46 def get_end(node) raise NotImplementedError, "get_end is not implemented" end |
#get_end_loc(node) ⇒ { line: Number, column: Number }
Get end location of ast node
60 61 62 |
# File 'lib/node_mutation/adapter.rb', line 60 def get_end_loc(node) raise NotImplementedError, "get_end_loc is not implemented" end |
#get_indent(node) ⇒ Number
Get indent of ast node
67 68 69 |
# File 'lib/node_mutation/adapter.rb', line 67 def get_indent(node) raise NotImplementedError, "get_indent is not implemented" end |
#get_source(node) ⇒ String
Get source code of the ast node
7 8 9 |
# File 'lib/node_mutation/adapter.rb', line 7 def get_source(node) raise NotImplementedError, "get_source is not implemented" end |
#get_start(node) ⇒ Number
Get start position of ast node
39 40 41 |
# File 'lib/node_mutation/adapter.rb', line 39 def get_start(node) raise NotImplementedError, "get_start is not implemented" end |
#get_start_loc(node) ⇒ { line: Number, column: Number }
Get start location of ast node
53 54 55 |
# File 'lib/node_mutation/adapter.rb', line 53 def get_start_loc(node) 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)`
17 18 19 |
# File 'lib/node_mutation/adapter.rb', line 17 def rewritten_source(node, code) raise NotImplementedError, "rewritten_source is not implemented" end |