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

Function is_constant_path

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

A constant, or a `scope_resolution` path of constants (`A::B::C`, a top-level `::A` / `::A::B`): what Ruby reads as a constant (isRubyConstantPath).

(node: Node)

Source from the content-addressed store, hash-verified

1154/// A constant, or a `scope_resolution` path of constants (`A::B::C`, a
1155/// top-level `::A` / `::A::B`): what Ruby reads as a constant (isRubyConstantPath).
1156fn is_constant_path(node: Node) -> bool {
1157 match node.kind() {
1158 "constant" => true,
1159 "scope_resolution" => {
1160 node.child_by_field_name("name").map_or(false, |n| n.kind() == "constant")
1161 && node.child_by_field_name("scope").map_or(true, is_constant_path)
1162 }
1163 _ => false,
1164 }
1165}
1166
1167/// isRubyClassMethod (languages/ruby.ts): `def self.x` / `def Widget.x` (a
1168/// singleton_method), or a `def` inside `class << self`.

Callers 2

constructed_classMethod · 0.85
extract_callMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected