Changeset 152

Show
Ignore:
Timestamp:
10/10/2007 15:11:38 (10 months ago)
Author:
why
Message:

* ext/sand_table/sand_table.c: let's allow Sandbox::Ref.method_missing to go unfiltered for now, since it's always under the control of the dungeon master.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ext/sand_table/sand_table.c

    r151 r152  
    10331033{ 
    10341034  return ruby_sandbox; 
     1035} 
     1036 
     1037/* 
     1038 *  call-seq: 
     1039 *     Sandbox::Ref.method_missing => obj 
     1040 * 
     1041 *  Executes the method under the class (or object)'s original environment, 
     1042 *  passing in and returning references as needed. 
     1043 */ 
     1044static VALUE 
     1045sandbox_ref_method_missing(argc, argv, self) 
     1046  int argc; 
     1047  VALUE *argv; 
     1048  VALUE self; 
     1049{ 
     1050  VALUE link = sandbox_get_linked_class(self); 
     1051  if (NIL_P(link)) { 
     1052    /* FIXME: oh, wait, this shouldn't happen! */ 
     1053    rb_raise(rb_eNoMethodError, "no link for %s", RSTRING(rb_inspect(self))->ptr); 
     1054  } else if (!SYMBOL_P(argv[0])) { 
     1055    rb_raise(rb_eArgError, "method_missing expects a symbolized method name"); 
     1056  } else { 
     1057    int i; 
     1058    sandkit *kit; 
     1059    VALUE box = sandbox_get_linked_box(self); 
     1060    Data_Get_Struct(box, sandkit, kit); 
     1061    return sandbox_run(kit, sandbox_method_wick(link, argc, argv)); 
     1062  } 
    10351063} 
    10361064 
     
    32153243  rb_cSandboxTransfer = rb_define_class_under(rb_cSandbox, "Transfer", rb_cObject); 
    32163244  rb_cSandboxRef = rb_define_class_under(rb_cSandbox, "Ref", rb_cObject); 
    3217   rb_define_method(rb_cSandboxRef, "method_missing", sandbox_boxedclass_method_missing, -1); 
     3245  rb_define_method(rb_cSandboxRef, "method_missing", sandbox_ref_method_missing, -1); 
    32183246  rb_undef_method(rb_singleton_class(rb_cSandboxRef), "new"); 
    32193247