//public object ExecuteReader(TextReader reader) //{ // Parser parser = new Parser(reader); // object result = null; // for (var command = parser.ParseCommand(); command != null; command = parser.ParseCommand()) // result = command.Evaluate(this.rootcontext); // return result; //} private static object NewInstance(RubyObject obj, Context context, IList <object> values) { var newobj = ((RubyClass)obj).CreateInstance(); var initialize = newobj.GetMethod("initialize"); if (initialize != null) { initialize.Apply(newobj, context, values); } return(newobj); }
private static object GetSingletonMethods(RubyObject obj, Context context, IList <object> values) { //var result = new RubyArray(); //var names = obj.SingletonClass.GetOwnInstanceMethodNames(); //foreach (var name in names) //{ // Symbol symbol = new Symbol(name); // if (!result.Contains(symbol)) // result.Add(symbol); //} //return result; throw new NotImplementedException(); }
public object Apply(RubyObject self, Context context, IList <object> values) { Context newcontext = new Context(self, this.context); int k = 0; int cv = values.Count; foreach (var parameter in this.parameters) { newcontext.SetLocalValue(parameter, values[k]); k++; } return(RubyObject.Eval(body)); //return this.body.Evaluate(newcontext); }
private static object GetClass(RubyObject obj, Context context, IList <object> values) { return(obj.Class); }
private static object GetSuperClass(RubyObject obj, Context context, IList <object> values) { return(((RubyClass)obj).SuperClass); }
private static object GetName(RubyObject obj, Context context, IList <object> values) { return(((RubyClass)obj).Name); }
public Context(RubyObject self, Context parent) { this.self = self; this.parent = parent; }
public Context(RubyClass module, Context parent) { this.module = module; this.parent = parent; this.self = module; }
public RubyObject(RubyObject prototype) { this["prototype"] = prototype; }
public object Apply(RubyObject self, Context context, IList <object> values) { return(this.lambda(self, context, values)); }