Class: Rational::compatible
Instance Method Summary collapse
-
#marshal_load ⇒ Object
private
:nodoc:.
Instance Method Details
#marshal_load ⇒ Object (private)
:nodoc:
1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 |
# File 'rational.c', line 1637
static VALUE
nurat_marshal_load(VALUE self, VALUE a)
{
rb_check_frozen(self);
rb_check_trusted(self);
Check_Type(a, T_ARRAY);
if (RARRAY_LEN(a) != 2)
rb_raise(rb_eArgError, "marshaled rational must have an array whose length is 2 but %ld", RARRAY_LEN(a));
if (f_zero_p(RARRAY_PTR(a)[1]))
rb_raise_zerodiv();
rb_ivar_set(self, id_i_num, RARRAY_PTR(a)[0]);
rb_ivar_set(self, id_i_den, RARRAY_PTR(a)[1]);
return self;
}
|