ActiveModel::Sanitizer
Class methods
Recursive Array(T) — dispatches to the appropriate sanitize for each element.
Recursive Set(T).
NOTE: post-sanitize de-duplication may shrink the set when two distinct
input values collapse to the same sanitized value (e.g. :text turns
both "<b>x</b>" and "x" into "x"). Use Array(T) if order/length
must be preserved.
Recursive Hash. Keys are identifiers and are not sanitized, so K can be any type; only V is walked.
JSON::Any — walk the tree, sanitize string leaves only. Non-string scalars (Int64, Float64, Bool, Nil) pass through untouched.
User-defined types opt in by including ActiveModel::Sanitizable.
Catch-all for union types. The strongly-typed overloads above win for
concrete static types; this fires only when value's compile-time type
is a union — which the macro walker has verified contains at least one
sanitizable arm. Used both for top-level union attributes (e.g.
String | Int32) and for union elements inside accepted containers
(e.g. Array(String | Int32)). The recursive sanitize(value, policy)
calls dispatch back to the strongly-typed overloads because Crystal
narrows value's type inside each is_a? branch.