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

Function is_class_method

codegraph-kernel/src/ruby.rs:1169–1181  ·  view source on GitHub ↗

isRubyClassMethod (languages/ruby.ts): `def self.x` / `def Widget.x` (a singleton_method), or a `def` inside `class << self`.

(node: Node)

Source from the content-addressed store, hash-verified

1167/// isRubyClassMethod (languages/ruby.ts): `def self.x` / `def Widget.x` (a
1168/// singleton_method), or a `def` inside `class << self`.
1169fn is_class_method(node: Node) -> bool {
1170 match node.kind() {
1171 "singleton_method" => true,
1172 "method" => {
1173 let mut parent = node.parent();
1174 if parent.map_or(false, |p| p.kind() == "body_statement") {
1175 parent = parent.and_then(|p| p.parent());
1176 }
1177 parent.map_or(false, |p| p.kind() == "singleton_class")
1178 }
1179 _ => false,
1180 }
1181}
1182
1183/// The Ruby `call` node whose argument_list (or keyword pair) contains `node`
1184/// — nearest `call` ancestor within 4 parent hops (function-ref.ts:837).

Callers 2

extract_functionMethod · 0.85
extract_methodMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected