MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / as_lines

Function as_lines

code2flow/ruby.py:134–148  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

132
133
134def 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
151def get_tree_body(tree_el):

Callers 2

get_tree_bodyFunction · 0.85
separate_namespacesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected