using System;
using System.Collections.Generic;
using System.Text;
using Ruby;
using VALUE = System.Int32;

namespace StarEngine.Ruby
{
    public partial class RubyInterpreter
    {
        private void InitializeCSharpCachedObjectModule()
        {
            VALUE mCSharpCachedObject = SERubyConsts.ForName("CSharpCachedObject");

            RUBY.rb_define_singleton_method(mCSharpCachedObject, "__cs_finalize__", this.mCSharpCachedObject_cs_finalize);
        }

        private VALUE mCSharpCachedObject_cs_finalize(VALUE self, VALUE id_id)
        {
            this.RemoveCachedObject(RUBY.NUM2INT(id_id));
            return RUBY.Qnil;
        }
    }
}
