Ruby ast bodies are structured differently depending on circumstances. This ensures that they are structured as a list of statements :param tree_el ast: :rtype: list[tree_el]
(tree_el)
| 132 | |
| 133 | |
| 134 | def as_lines(tree_el): |
| 135 | """ |
| 136 | Ruby ast bodies are structured differently depending on circumstances. |
| 137 | This ensures that they are structured as a list of statements |
| 138 | |
| 139 | :param tree_el ast: |
| 140 | :rtype: list[tree_el] |
| 141 | """ |
| 142 | if not tree_el: |
| 143 | return [] |
| 144 | if isinstance(tree_el[0], list): |
| 145 | return tree_el |
| 146 | if tree_el[0] == 'begin': |
| 147 | return tree_el |
| 148 | return [tree_el] |
| 149 | |
| 150 | |
| 151 | def get_tree_body(tree_el): |
no outgoing calls
no test coverage detected