pub fn to_str(interp: &mut Artichoke, value: Value) -> Result<Value, Error>
Expand description
Fallible conversion of the given value to a Ruby String
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
a non-nil
Ruby String
.
ยงErrors
- If the call to
#to_str
returns an error, that error is returned. - If the call to
#to_str
returns anything other than aString
, aTypeError
is returned.