From: Ian Macdonald Date: 2005-02-26T05:12:11+09:00 Subject: Purpose of rb_assoc_new() Hello, I recently took over the maintenance of the Ruby/LDAP library and am stuck on interpreting the following line: tmp = rb_assoc_new (op, rb_ary_new ()); I can't find an explanation of rb_assoc_new() anywhere. It's used all over the Ruby source code and yet I still can't figure what's going on. I know that rb_ary_new() makes a new array, which is presumably being associated with tmp, but what does op have to do with it? array.c has the definition: VALUE rb_assoc_new(car, cdr) VALUE car, cdr; { VALUE ary; ary = rb_ary_new2(2); RARRAY(ary)->ptr[0] = car; RARRAY(ary)->ptr[1] = cdr; RARRAY(ary)->len = 2; return ary; } Is this just a convenient way to instantiate a two element array? Ian -- Ian Macdonald | He knew the tavernes well in every toun. System Administrator | -- Geoffrey Chaucer ian@caliban.org | http://www.caliban.org | |