/* * call-seq: * groups -> array * * Returns the names of all the groups who received this message. * * XXX: document Spread::MembershipMessage#members as well */ static VALUE sm_groups(VALUE obj) { struct SpreadMessage *sp_mess; Data_Get_Struct(obj, struct SpreadMessage, sp_mess); if (NIL_P(sp_mess->rb_groups)) { /* First call, so initialize and cache the array */ int i; sp_mess->rb_groups = rb_ary_new2(sp_mess->num_groups); for (i = 0; i < sp_mess->num_groups; i++) { VALUE group_str = rb_str_new2(sp_mess->groups[i]); rb_ary_store(sp_mess->rb_groups, i, group_str); } } return sp_mess->rb_groups; }