method
_load
ruby latest stable - Class:
BigDecimal
_load(p1)public
Internal method used to provide marshalling support. See the Marshal module.
static VALUE
BigDecimal_load(VALUE self, VALUE str)
{
ENTER(2);
Real *pv;
unsigned char *pch;
unsigned char ch;
unsigned long m=0;
pch = (unsigned char *)StringValueCStr(str);
rb_check_safe_obj(str);
/* First get max prec */
while((*pch) != (unsigned char)'\0' && (ch = *pch++) != (unsigned char)':') {
if(!ISDIGIT(ch)) {
rb_raise(rb_eTypeError, "load failed: invalid character in the marshaled string");
}
m = m*10 + (unsigned long)(ch-'0');
}
if (m > VpBaseFig()) m -= VpBaseFig();
GUARD_OBJ(pv, VpNewRbClass(m, (char *)pch, self));
m /= VpBaseFig();
if (m && pv->MaxPrec > m) {
pv->MaxPrec = m+1;
}
return ToValue(pv);
} Related methods
- Instance methods
- %
- *
- **
- +
- +@
- -
- -@
- /
- <
- <=
- <=>
- ==
- ===
- >
- >=
- _dump
- abs
- add
- as_json
- ceil
- clone
- coerce
- div
- divmod
- dup
- eql?
- exponent
- finite?
- fix
- floor
- frac
- hash
- infinite?
- initialize_copy
- inspect
- modulo
- mult
- nan?
- nonzero?
- power
- precs
- quo
- remainder
- round
- sign
- split
- sqrt
- sub
- to_d
- to_digits
- to_f
- to_i
- to_int
- to_json
- to_r
- to_s
- truncate
- zero?
- Class methods
- _load
- double_fig
- json_create
- limit
- mode
- new
- save_exception_mode
- save_limit
- save_rounding_mode
- ver