MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isRubyClassMethod

Function isRubyClassMethod

src/extraction/languages/ruby.ts:11–17  ·  view source on GitHub ↗

* A class method: `def self.x` or `def Widget.x` (a singleton_method), or a * `def` inside `class << self`. It shares its qualified name with an instance * method of the same name (`Widget::build` for both), so only this tells the * two apart.

(node: SyntaxNode)

Source from the content-addressed store, hash-verified

9 * two apart.
10 */
11function isRubyClassMethod(node: SyntaxNode): boolean {
12 if (node.type === 'singleton_method') return true;
13 if (node.type !== 'method') return false;
14 let parent = node.parent;
15 if (parent?.type === 'body_statement') parent = parent.parent;
16 return parent?.type === 'singleton_class';
17}
18
19export const rubyExtractor: LanguageExtractor = {
20 functionTypes: ['method'],

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected