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

Method visibility_of

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

rubyExtractor.getVisibility — walk the previousNamedSibling chain (unbounded, through non-matching siblings); the first `call` sibling whose `method` text is private/protected/public decides; else public. Bug-for-bug: a BARE `private` line parses as identifier (invisible), and a matching call poisons every later sibling def regardless of ruby's actual arg-scoped semantics.

(&self, node: Node)

Source from the content-addressed store, hash-verified

359 /// and a matching call poisons every later sibling def regardless of
360 /// ruby's actual arg-scoped semantics.
361 fn visibility_of(&self, node: Node) -> u8 {
362 let mut sibling = node.prev_named_sibling();
363 while let Some(s) = sibling {
364 if s.kind() == "call" {
365 if let Some(method) = s.child_by_field_name("method") {
366 match self.text(method) {
367 "private" => return 2,
368 "protected" => return 3,
369 "public" => return 1,
370 _ => {}
371 }
372 }
373 }
374 sibling = s.prev_named_sibling();
375 }
376 1 // public
377 }
378
379 // --- the visitNode hook (languages/ruby.ts:19-76) ---------------------------
380

Callers 3

extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_classMethod · 0.45

Calls 1

textMethod · 0.45

Tested by

no test coverage detected