method
induced_from
ruby latest stable - Class:
Float
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.
induced_from(p1)public
Convert obj to a float.
/*
* call-seq:
* Float.induced_from(obj) => float
*
* Convert <code>obj</code> to a float.
*/
static VALUE
rb_flo_induced_from(klass, x)
VALUE klass, x;
{
switch (TYPE(x)) {
case T_FIXNUM:
case T_BIGNUM:
return rb_funcall(x, rb_intern("to_f"), 0);
case T_FLOAT:
return x;
default:
rb_raise(rb_eTypeError, "failed to convert %s into Float",
rb_obj_classname(x));
}
}