(#18916) Ruby evaluation function

Evaluates inline Ruby code and returns the result.
Similar to inline_template() but doesn't require wrapping in a template
and can return other data types than strings.