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

Function is_class_method

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

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