コード例 #1
0
        public static void RegisterEnum <T> (RubyState state)
        {
            Type type = typeof(T);

            IntPtr module = UserDataUtility.DefineCSharpEnum(state, type);

            foreach (int i in System.Enum.GetValues(type))
            {
                RubyDLL.r_define_const(state, module, System.Enum.GetName(type, i), RubyDLL.mrb_fixnum_value(state, i));
            }
        }