public Machine() { this.requirepaths.Add("."); var basicobjectclass = new DynamicClass("BasicObject", null); var objectclass = new DynamicClass("Object", basicobjectclass); var moduleclass = new DynamicClass("Module", objectclass); var classclass = new DynamicClass("Class", moduleclass); this.rootcontext.SetLocalValue("BasicObject", basicobjectclass); this.rootcontext.SetLocalValue("Object", objectclass); this.rootcontext.SetLocalValue("Module", moduleclass); this.rootcontext.SetLocalValue("Class", classclass); basicobjectclass.SetClass(classclass); objectclass.SetClass(classclass); moduleclass.SetClass(classclass); classclass.SetClass(classclass); basicobjectclass.SetInstanceMethod("class", new LambdaFunction(GetClass)); basicobjectclass.SetInstanceMethod("methods", new LambdaFunction(GetMethods)); basicobjectclass.SetInstanceMethod("singleton_methods", new LambdaFunction(GetSingletonMethods)); moduleclass.SetInstanceMethod("superclass", new LambdaFunction(GetSuperClass)); moduleclass.SetInstanceMethod("name", new LambdaFunction(GetName)); classclass.SetInstanceMethod("new", new LambdaFunction(NewInstance)); this.rootcontext.SetLocalValue("Fixnum", new FixnumClass(this)); this.rootcontext.SetLocalValue("Float", new FloatClass(this)); this.rootcontext.SetLocalValue("String", new StringClass(this)); this.rootcontext.SetLocalValue("NilClass", new NilClass(this)); this.rootcontext.SetLocalValue("FalseClass", new FalseClass(this)); this.rootcontext.SetLocalValue("TrueClass", new TrueClass(this)); this.rootcontext.SetLocalValue("Array", new ArrayClass(this)); this.rootcontext.SetLocalValue("Hash", new HashClass(this)); this.rootcontext.SetLocalValue("Range", new RangeClass(this)); this.rootcontext.Self = objectclass.CreateInstance(); this.rootcontext.Self.Class.SetInstanceMethod("puts", new PutsFunction(System.Console.Out)); this.rootcontext.Self.Class.SetInstanceMethod("print", new PrintFunction(System.Console.Out)); this.rootcontext.Self.Class.SetInstanceMethod("require", new RequireFunction(this)); }