private void CreateMethods() { foreach (var method in _methods.Where(m => _methodCount[m.Name] == 1)) { var rubyMethod = RubyMethod.CreateRubyMethod(method); if (rubyMethod != null) { Methods.Add(rubyMethod); } } foreach (var method in _methods.Where(m => _methodCount[m.Name] > 1 && !Methods.Select(rm => rm.MethodName ?? null).Contains(m.Name))) { var rubyMethod = RubyMethod.CreateOverloadedRubyMethod(method); if (rubyMethod != null) { Methods.Add(rubyMethod); } } }
public RubyClass(Type type, string moduleName) { ModuleName = moduleName; ClassName = type.Name; _methodCount = new Dictionary <string, int>(); _methods = type.GetMethods().Where(m => m.DeclaringType == type && m.IsPublic && !m.IsVirtual).ToList(); Methods = new List <RubyMethod>(); _constructors = type.GetConstructors(); if (_constructors.Length > 0) { Methods.Add(RubyMethod.CreateRubyConstructor(_constructors)); } CountMethods(); CreateMethods(); if (type.BaseType.Name != "Object") { BaseName = type.BaseType.Name; } }