Esempio n. 1
0
 VALUE rb_cstr_to_inum(const char* str, int base, int badcheck) {
   NativeMethodEnvironment* env = NativeMethodEnvironment::get();
   Integer* i = Integer::from_cstr(env->state(), str, str + strlen(str),
                                   base, RBOOL(badcheck));
   if(i->nil_p()) {
     rb_raise(rb_eArgError, "invalid string for Integer");
   }
   return env->get_handle(i);
 }
Esempio n. 2
0
  Integer* String::to_inum_prim(STATE, Fixnum* base, Object* strict) {
    Integer* val = to_i(state, base, strict);
    if(val->nil_p()) return (Integer*)Primitives::failure();

    return val;
  }