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

Function is_class_method

codegraph-kernel/src/ruby.rs:1179–1191  ·  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

1177/// isRubyClassMethod (languages/ruby.ts): `def self.x` / `def Widget.x` (a
1178/// singleton_method), or a `def` inside `class << self`.
1179fn is_class_method(node: Node) -> bool {
1180 match node.kind() {
1181 "singleton_method" => true,
1182 "method" => {
1183 let mut parent = node.parent();
1184 if parent.map_or(false, |p| p.kind() == "body_statement") {
1185 parent = parent.and_then(|p| p.parent());
1186 }
1187 parent.map_or(false, |p| p.kind() == "singleton_class")
1188 }
1189 _ => false,
1190 }
1191}
1192
1193/// The Ruby `call` node whose argument_list (or keyword pair) contains `node`
1194/// — 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