/*
* call-seq:
* Node._load(str) => Node
*
* Load a dumped node.
*/
static VALUE node_load(VALUE klass, VALUE str)
{
VALUE arr, node_hash, node_id, id_hash;
NODE * n;
VALUE data;
if( ruby_safe_level >= 4
|| (ruby_safe_level >= 1 && OBJ_TAINTED(str)))
{
/* no playing with knives in the sandbox */
rb_raise(rb_eSecurityError, "Insecure: can't load node");
}
arr = marshal_load(str);
node_hash = rb_ary_pop(arr);
node_id = rb_ary_pop(arr);
id_hash = rb_hash_new();
data = rb_hash_aref(node_hash, node_id);
n = load_node_from_hash(data, node_id, node_hash, id_hash);
/* TODO: Need a free function in this case */
return wrap_node(n);
}