rubyExtractor.extractBareCall (languages/ruby.ts:77-105).
(&self, node: Node)
| 621 | |
| 622 | /// rubyExtractor.extractBareCall (languages/ruby.ts:77-105). |
| 623 | fn bare_call_name(&self, node: Node) -> Option<&'t str> { |
| 624 | if node.kind() != "identifier" { |
| 625 | return None; |
| 626 | } |
| 627 | let parent = node.parent()?; |
| 628 | if !matches!( |
| 629 | parent.kind(), |
| 630 | "body_statement" | "then" | "else" | "do" | "begin" | "rescue" | "ensure" | "when" |
| 631 | ) { |
| 632 | return None; |
| 633 | } |
| 634 | let name = self.text(node); |
| 635 | if matches!( |
| 636 | name, |
| 637 | "true" | "false" | "nil" | "self" | "super" | "__FILE__" | "__LINE__" | "__dir__" |
| 638 | ) { |
| 639 | return None; |
| 640 | } |
| 641 | // charCodeAt(0) in [65,90] — ASCII uppercase only (constants). |
| 642 | let first = name.as_bytes().first().copied().unwrap_or(0); |
| 643 | if (65..=90).contains(&first) { |
| 644 | return None; |
| 645 | } |
| 646 | Some(name) |
| 647 | } |
| 648 | |
| 649 | // --- extractors -------------------------------------------------------------- |
| 650 |
no test coverage detected