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

Function isRubyClassMethod

src/extraction/languages/ruby.ts:19–25  ·  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

17 * two apart.
18 */
19function isRubyClassMethod(node: SyntaxNode): boolean {
20 if (node.type === 'singleton_method') return true;
21 if (node.type !== 'method') return false;
22 let parent = node.parent;
23 if (parent?.type === 'body_statement') parent = parent.parent;
24 return parent?.type === 'singleton_class';
25}
26
27export const rubyExtractor: LanguageExtractor = {
28 functionTypes: ['method'],

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected