Commit 7a2bee29

7a2bee2907ffMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified

Description

String#crypt and String#rindex

crypt(salt) returns the deterministic 13-char hash (sp_str_crypt). rindex(sub) returns the last match offset; a nil argument raises TypeError via the runtime helper.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
7a2bee2907ff
Parent
f3e805cf3909

src/analyze.cmodifiedView file

@@ -633,7 +633,8 @@
633633 }
634634 if (!strcmp(name, "index") || !strcmp(name, "to_i") || !strcmp(name, "count") ||
635635 !strcmp(name, "oct") || !strcmp(name, "ord") || !strcmp(name, "casecmp")) return TY_INT;
636- if (!strcmp(name, "scrub")) return TY_STRING;
636+ if (!strcmp(name, "scrub") || !strcmp(name, "crypt")) return TY_STRING;
637+ if (!strcmp(name, "rindex")) return TY_INT;
637638 if (!strcmp(name, "partition") || !strcmp(name, "rpartition")) return TY_STR_ARRAY;
638639 if (!strcmp(name, "casecmp?")) return TY_BOOL;
639640 if (!strcmp(name, "to_f")) return TY_FLOAT;