How to remove ipc resources

Hi,

In my ruby script, currently, programs calls shell script by using
system() function calling ipcrm.

Is there any idea to do this job as a natural way(not system, with
ruby own function) ?