rubyExtractor.extractBareCall (languages/ruby.ts:77-105).
(&self, node: Node)
| 568 | |
| 569 | /// rubyExtractor.extractBareCall (languages/ruby.ts:77-105). |
| 570 | fn bare_call_name(&self, node: Node) -> Option<&'t str> { |
| 571 | if node.kind() != "identifier" { |
| 572 | return None; |
| 573 | } |
| 574 | let parent = node.parent()?; |
| 575 | if !matches!( |
| 576 | parent.kind(), |
| 577 | "body_statement" | "then" | "else" | "do" | "begin" | "rescue" | "ensure" | "when" |
| 578 | ) { |
| 579 | return None; |
| 580 | } |
| 581 | let name = self.text(node); |
| 582 | if matches!( |
| 583 | name, |
| 584 | "true" | "false" | "nil" | "self" | "super" | "__FILE__" | "__LINE__" | "__dir__" |
| 585 | ) { |
| 586 | return None; |
| 587 | } |
| 588 | // charCodeAt(0) in [65,90] — ASCII uppercase only (constants). |
| 589 | let first = name.as_bytes().first().copied().unwrap_or(0); |
| 590 | if (65..=90).contains(&first) { |
| 591 | return None; |
| 592 | } |
| 593 | Some(name) |
| 594 | } |
| 595 | |
| 596 | // --- extractors -------------------------------------------------------------- |
| 597 |
no test coverage detected