6th
Tue
Ruby拡張の中でHashをiterateする方法
This article was migrated from http://rai
以下は、rb_iterate
static VALUE iterator_p roc(VALUE Pair, VALUE Arg, VALUE Self){
VALUE Key = RARRAY(Pair)->ptr[0];
VALUE Value = RARRAY(Pair)->ptr[1];
return Qnil;
}
rb_iterate (rb_each, Hash, iterator_p roc, Arg);
Hash
はiterateされるべきHash、
Arg
はイテレータ・ブロック関数に渡される任意のVALUEです。
This article was migrated from http://rai
posted by
genki
on Tue 6 Mar 2007
at 10:10