public virtual RBasic BasicSend(string name, RBasic[] args, RCBlock block) { RMetaObject origin; RCMethod m = (RCMethod)klass.SearchMethod(name, out origin); /* * Console.WriteLine("sending"); * Console.WriteLine("self " + this.ToString()); * Console.WriteLine("send " + name + " found " + m.ToString()); * foreach(RBasic ro in args) { * Console.WriteLine("arg " + ro.ToString()); * } */ if (m == null) { Console.WriteLine("Available methods:"); foreach (object o in klass.ClassInstanceMethods(new object[] { ruby.oTrue })) { Console.WriteLine(o.ToString()); } throw new Exception("Method not found: " + name); } return(m.Call(ruby.GetCurrentContext(), this, args, block)); }
private RArray MethodList(bool inherited_too, InsMethods ins) { ArrayList ary = new ArrayList(); lock (this) { for (RMetaObject klass = this; klass != null; klass = klass.super) { foreach (DictionaryEntry entry in klass.m_tbl) { ////string s = ins.Inspect(ruby, (uint)entry.Key, (RNode)entry.Value); RCMethod m = (RCMethod)entry.Value; string s = m.Name; if (s != null && ary.Contains(s) == false) { ary.Add(s); } } if (inherited_too == false) { break; } } } return(new RArray(ruby, ary)); }
public void DefineMethod(string name, RCMethod rm) { m_tbl[name] = rm; }