rubyExtractor.extractBareCall (languages/ruby.ts:77-105).
(&self, node: Node)
| 596 | |
| 597 | /// rubyExtractor.extractBareCall (languages/ruby.ts:77-105). |
| 598 | fn bare_call_name(&self, node: Node) -> Option<&'t str> { |
| 599 | if node.kind() != "identifier" { |
| 600 | return None; |
| 601 | } |
| 602 | let parent = node.parent()?; |
| 603 | if !matches!( |
| 604 | parent.kind(), |
| 605 | "body_statement" | "then" | "else" | "do" | "begin" | "rescue" | "ensure" | "when" |
| 606 | ) { |
| 607 | return None; |
| 608 | } |
| 609 | let name = self.text(node); |
| 610 | if matches!( |
| 611 | name, |
| 612 | "true" | "false" | "nil" | "self" | "super" | "__FILE__" | "__LINE__" | "__dir__" |
| 613 | ) { |
| 614 | return None; |
| 615 | } |
| 616 | // charCodeAt(0) in [65,90] — ASCII uppercase only (constants). |
| 617 | let first = name.as_bytes().first().copied().unwrap_or(0); |
| 618 | if (65..=90).contains(&first) { |
| 619 | return None; |
| 620 | } |
| 621 | Some(name) |
| 622 | } |
| 623 | |
| 624 | // --- extractors -------------------------------------------------------------- |
| 625 |
no test coverage detected