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