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
i...@caliban.org |
http://www.caliban.org |
|
> --
> Este correo esta libre de virus!
>
--
Este correo esta libre de virus!
Why, yes.
PDF::Writer.
But wait -- there's a major release coming out in the next couple of
weeks; I don't think that I'm going to make my original target date of
1 March, but it shouldn't be too much longer after that.
-austin
--
Austin Ziegler * halos...@gmail.com
* Alternate: aus...@halostatue.ca
-Charlie
See you
Marcelo
----- Original Message -----
From: "Austin Ziegler" <halos...@gmail.com>
To: "ruby-talk ML" <ruby...@ruby-lang.org>
In message "Re: Purpose of rb_assoc_new()"
on Sat, 26 Feb 2005 05:12:11 +0900, Ian Macdonald <i...@caliban.org> writes:
|Is this just a convenient way to instantiate a two element array?
Yes.
matz.