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

Function is_constant_path

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

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