pub fn check_to_str(
    interp: &mut Artichoke,
    value: Value
) -> Result<Value, Error>
Expand description

Fallible conversion of the given value to a Ruby String or nil via #to_str.

If the given value is a string, it is returned. If the give value responds to a #to_str method, it is called. Otherwise, a TypeError is raised.

If this function returns Ok, the returned Value is guaranteed to be either a Ruby String or nil.


  • If the call to #to_str returns an error, that error is returned.
  • If the call to #to_str returns anything other than a String or nil, a TypeError is returned.