Coerce Ruby values to native numerics (floats and integers).
Required Associated Types§
Concrete type of boxed Ruby value as inputs to coerce functions.
Concrete float type to coerce values into, e.g.
Concrete error type for errors encountered when coercing values.
Coerce the given Ruby value to a
This coercion mechanism is used by Ruby to handle mixed-type numeric operations: it is intended to find a compatible common type between the two operands of the operator.
If a Ruby
nil is given, an error is returned.
If the given value does not subclass
Numeric, an error is returned.
Numeric class is not defined, an error is returned.
If the underlying interpreter returns an error when calling
Numeric#coerce, the error is returned.