isRubyHookCall (function-ref.ts:282-286).
(name: &str)
| 41 | |
| 42 | /// isRubyHookCall (function-ref.ts:282-286). |
| 43 | fn is_ruby_hook_call(name: &str) -> bool { |
| 44 | static RE: OnceLock<Regex> = OnceLock::new(); |
| 45 | let re = RE.get_or_init(|| Regex::new(r"^(skip_)?(before|after|around)_[a-z_]+$").unwrap()); |
| 46 | re.is_match(name) |
| 47 | || matches!(name, "validate" | "set_callback" | "helper_method" | "rescue_from") |
| 48 | } |
| 49 | |
| 50 | /// The hook-DSL symbol shape (`/^[A-Za-z_][A-Za-z0-9_?!]*$/`). |
| 51 | fn ruby_sym_re() -> &'static Regex { |
no test coverage detected