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

Function get_inherits

code2flow/ruby.py:168–191  ·  view source on GitHub ↗

Get the various types of inheritances this class/module can have :param tree ast: :param body_tree list[ast] :rtype: list[str]

(tree, body_tree)

Source from the content-addressed store, hash-verified

166
167
168def get_inherits(tree, body_tree):
169 """
170 Get the various types of inheritances this class/module can have
171
172 :param tree ast:
173 :param body_tree list[ast]
174 :rtype: list[str]
175 """
176 inherits = []
177
178 # extends
179 if tree[0] == 'class' and tree[2]:
180 inherits.append(tree[2][2])
181
182 # module automatically extends same-named modules
183 if tree[0] == 'module':
184 inherits.append(tree[1][2])
185
186 # mixins
187 for el in body_tree:
188 if el[0] == 'send' and el[2] == 'include':
189 inherits.append(el[3][2])
190
191 return inherits
192
193
194class Ruby(BaseLanguage):

Callers 1

make_class_groupMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected