edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Console/Program.cs;C576154
File: Program.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Console/Program.cs;C576154  (server)    10/16/2008 8:01 PM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Console/Program.cs;IronRails2
@@ -36,7 +36,7 @@
     }
 
     protected override LanguageSetup CreateLanguageSetup() {
-        return Ruby.CreateLanguageSetup();
+        return Ruby.CreateRubySetup();
     }
 
     [STAThread]
===================================================================
edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/HostingTests.cs;C598108
File: HostingTests.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/HostingTests.cs;C598108  (server)    10/15/2008 11:37 AM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/HostingTests.cs;IronRails2
@@ -65,7 +65,7 @@
             // the library paths are incorrect (not combined with location of .exe file) in partial trust:
             if (_driver.PartialTrust) return;
 
-            bool result = Engine.RequireFile("fcntl");
+            bool result = Engine.RequireRubyFile("fcntl");
             Assert(result == true);
 
             var module = Runtime.Globals.GetVariable("Fcntl");
===================================================================
edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Ruby.cs;C589278
File: Ruby.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Ruby.cs;C589278  (server)    10/15/2008 2:13 PM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Ruby.cs;IronRails2
@@ -19,6 +19,10 @@
 using Microsoft.Scripting.Runtime;
 using IronRuby.Runtime;
 using IronRuby.Builtins;
+using System.ComponentModel;
+using System;
+using System.Collections;
+using System.Collections.Generic;
 
 #if SILVERLIGHT
 [assembly: DynamicLanguageProvider(typeof(RubyContext), RubyContext.IronRubyDisplayName, RubyContext.IronRubyNames, RubyContext.IronRubyFileExtensions)]
@@ -26,25 +30,32 @@
 
 namespace IronRuby {
     
-    // TODO: 
-    // design this class 
-
     public static class Ruby {
+        /// <summary>
+        /// Creates a new script runtime configured using .NET configuration files.
+        /// If the .NET configuration doesn't include IronRuby a default IronRuby configuration is added.
+        /// </summary>
         public static ScriptRuntime/*!*/ CreateRuntime() {
-            return new ScriptRuntime(ScriptRuntimeSetup.ReadConfiguration());
+            var setup = ScriptRuntimeSetup.ReadConfiguration();
+            setup.AddRubySetup();
+            return new ScriptRuntime(setup);
         }
 
+        /// <summary>
+        /// Creates a new script runtime and returns its IronRuby engine.
+        /// </summary>
+        public static ScriptEngine/*!*/ CreateEngine() {
+            return GetEngine(CreateRuntime());
+        }
+
         public static ScriptRuntime/*!*/ CreateRuntime(ScriptRuntimeSetup/*!*/ setup) {
             return new ScriptRuntime(setup);
         }
 
-        public static ScriptRuntimeSetup/*!*/ CreateRuntimeSetup() {
-            var setup = new ScriptRuntimeSetup();
-            setup.LanguageSetups.Add(CreateLanguageSetup());
-            return setup;
-        }
-
-        public static LanguageSetup/*!*/ CreateLanguageSetup() {
+        /// <summary>
+        /// Creates IronRuby setup with default language names and file extensions.
+        /// </summary>
+        public static LanguageSetup/*!*/ CreateRubySetup() {
             return new LanguageSetup(
                 typeof(RubyContext).AssemblyQualifiedName,
                 RubyContext.IronRubyDisplayName,
@@ -53,23 +64,24 @@
             );
         }
 
+        /// <summary>
+        /// Creates IronRuby setup with default language names, default file extensions and given options.
+        /// </summary>
+        public static LanguageSetup/*!*/ CreateRubySetup(IDictionary<string, object>/*!*/ options) {
+            var result = CreateRubySetup();
+            foreach (var entry in options) {
+                result.Options[entry.Key] = entry.Value;
+            }
+            return result;
+        }
+
         public static ScriptEngine/*!*/ GetEngine(ScriptRuntime/*!*/ runtime) {
             ContractUtils.RequiresNotNull(runtime, "runtime");
             return runtime.GetEngineByTypeName(typeof(RubyContext).AssemblyQualifiedName);
         }
 
-        public static RubyExecutionContext/*!*/ GetExecutionContext(ScriptEngine/*!*/ engine) {
+        public static bool RequireFile(ScriptEngine/*!*/ engine, string/*!*/ path) {
             ContractUtils.RequiresNotNull(engine, "engine");
-            return ((RubyContext)HostingHelpers.GetLanguageContext(engine)).ExecutionContext;
-        }
-        
-        public static RubyExecutionContext/*!*/ GetExecutionContext(ScriptRuntime/*!*/ runtime) {
-            ContractUtils.RequiresNotNull(runtime, "runtime");
-            return GetExecutionContext(GetEngine(runtime));
-        }
-
-        public static bool RequireFile(this ScriptEngine/*!*/ engine, string/*!*/ path) {
-            ContractUtils.RequiresNotNull(engine, "engine");
             ContractUtils.RequiresNotNull(path, "path");
 
             return HostingHelpers.CallEngine<string, bool>(engine, RequireFile, path);
@@ -80,5 +92,60 @@
             return rc.ExecutionContext.Loader.LoadFile(rc.DefaultGlobalScope, null, MutableString.Create(path), 
                 LoadFlags.LoadOnce | LoadFlags.AppendExtensions);
         }
+
+        // TODO:
+        public static RubyExecutionContext/*!*/ GetExecutionContext(ScriptEngine/*!*/ engine) {
+            ContractUtils.RequiresNotNull(engine, "engine");
+            return ((RubyContext)HostingHelpers.GetLanguageContext(engine)).ExecutionContext;
+        }
+
+        // TODO:
+        public static RubyExecutionContext/*!*/ GetExecutionContext(ScriptRuntime/*!*/ runtime) {
+            ContractUtils.RequiresNotNull(runtime, "runtime");
+            return GetExecutionContext(GetEngine(runtime));
+        }
     }
+
+    [EditorBrowsable(EditorBrowsableState.Never)]
+    public static class RubyHostingExtensions {
+        public static bool RequireRubyFile(this ScriptEngine/*!*/ engine, string/*!*/ path) {
+            return Ruby.RequireFile(engine, path);
+        }
+
+        public static ScriptEngine/*!*/ GetRubyEngine(this ScriptRuntime/*!*/ runtime) {
+            return Ruby.GetEngine(runtime);
+        }
+
+        public static LanguageSetup/*!*/ AddRubySetup(this ScriptRuntimeSetup/*!*/ runtimeSetup) {
+            return AddRubySetup(runtimeSetup, null);
+        }
+
+        /// <summary>
+        /// Adds a new Ruby setup into the given runtime setup unless Ruby setup is already there.
+        /// Returns the newly created setup or the existing one.
+        /// If non-null <paramref name="newSetupInitializer"/> is given and a new setup is created runs the initializer on the new setup instance.
+        /// </summary>
+        public static LanguageSetup/*!*/ AddRubySetup(this ScriptRuntimeSetup/*!*/ runtimeSetup, Action<LanguageSetup> newSetupInitializer) {
+            ContractUtils.RequiresNotNull(runtimeSetup, "runtimeSetup");
+
+            var langSetup = TryGetLanguageSetup(runtimeSetup);
+            if (langSetup == null) {
+                langSetup = Ruby.CreateRubySetup();
+                if (newSetupInitializer != null) {
+                    newSetupInitializer(langSetup);
+                }
+                runtimeSetup.LanguageSetups.Add(langSetup);
+            }
+            return langSetup;
+        }
+
+        private static LanguageSetup TryGetLanguageSetup(ScriptRuntimeSetup/*!*/ runtimeSetup) {
+            foreach (var langSetup in runtimeSetup.LanguageSetups) {
+                if (langSetup.TypeName == typeof(RubyContext).AssemblyQualifiedName) {
+                    return langSetup;
+                }
+            }
+            return null;
+        }
+    }
 }
===================================================================
edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Builtins/IO.cs;C596379
File: IO.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Builtins/IO.cs;C596379  (server)    10/15/2008 1:03 PM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Builtins/IO.cs;IronRails2
@@ -407,24 +407,51 @@
         // returns the number of bytes written to the stream:
         public int Write(char[]/*!*/ buffer, int index, int count) {
             byte[] bytes = _externalEncoding.GetBytes(buffer, index, count);
-            _stream.Write(bytes, 0, bytes.Length);
+            Write(bytes, 0, bytes.Length);
             return bytes.Length;
         }
 
         // returns the number of bytes written to the stream:
         public int Write(string/*!*/ value) {
             byte[] bytes = _externalEncoding.GetBytes(value);
-            _stream.Write(bytes, 0, bytes.Length);
+            Write(bytes, 0, bytes.Length);
             return bytes.Length;
         }
 
         // returns the number of bytes written to the stream:
         public int Write(MutableString/*!*/ value) {
             byte[] bytes = value.ToByteArray();
-            _stream.Write(bytes, 0, bytes.Length);
-            return bytes.Length;
+            return Write(bytes, 0, bytes.Length);
         }
 
+        public int Write(byte[]/*!*/ buffer, int index, int count) {
+            if (_preserveEndOfLines) {
+                _stream.Write(buffer, index, count);
+                return buffer.Length;
+            } else {
+                int bytesWritten = 0;
+                int i = index;
+                while (i < count) {
+                    int j = i;
+                    while (j < buffer.Length && buffer[j] != (byte)'\n') {
+                        j++;
+                    }
+                    _stream.Write(buffer, i, j - i);
+                    bytesWritten += j - i;
+
+                    if (j < buffer.Length) {
+                        _stream.WriteByte((byte)'\r');
+                        _stream.WriteByte((byte)'\n');
+                        bytesWritten += 2;
+                    }
+
+                    i = j + 1;
+                }
+
+                return bytesWritten;
+            }
+        }
+
         public int PeekByte() {
             int result;
             if (_peekAhead != -1) {
===================================================================
edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs;C576154
File: RubyCommandLine.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs;C576154  (server)    10/15/2008 2:29 PM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Hosting/RubyCommandLine.cs;IronRails2
@@ -17,6 +17,8 @@
 using Microsoft.Scripting.Hosting.Shell;
 using IronRuby.Builtins;
 using IronRuby.Runtime;
+using Microsoft.Scripting.Runtime;
+using Microsoft.Scripting;
 
 namespace IronRuby.Hosting {
    
@@ -46,5 +48,11 @@
         protected override int RunFile(string fileName) {
             return RunFile(Language.CreateFileUnit(fileName, BinaryEncoding.Instance));
         }
+
+        protected override Scope/*!*/ CreateScope() {
+            Scope scope = base.CreateScope();
+            scope.SetName(SymbolTable.StringToId("iron_ruby"), Engine);
+            return scope;
+        }
     }
 }
===================================================================
edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;C597872
File: RubyExecutionContext.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;C597872  (server)    10/15/2008 11:41 AM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyExecutionContext.cs;IronRails2
@@ -1463,12 +1463,12 @@
                     _traceListenerSuspended = true;
 
                     _traceListener.Call(new[] {
-                        MutableString.Create("call"),              // event
-                        fileName,                                  // file
-                        RuntimeHelpers.Int32ToObject(lineNumber),  // line
-                        SymbolTable.StringToId(name),              // TODO: alias
-                        new Binding(scope),                        // binding
-                        module.IsSingletonClass ? ((RubyClass)module).SingletonClassOf : module // module
+                        MutableString.Create("call"),                                             // event
+                        fileName != null ? MutableString.Create(fileName) : null,                 // file
+                        RuntimeHelpers.Int32ToObject(lineNumber),                                 // line
+                        SymbolTable.StringToId(name),                                             // TODO: alias
+                        new Binding(scope),                                                       // binding
+                        module.IsSingletonClass ? ((RubyClass)module).SingletonClassOf : module   // module
                     });
                 } finally {
                     _traceListenerSuspended = false;
===================================================================
edit: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;C601093
File: RubyOps.cs
===================================================================
--- $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;C601093  (server)    10/15/2008 11:29 AM
+++ Shelved Change: $/Dev10/feature/vsl_dynamic/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyOps.cs;IronRails2
@@ -170,7 +170,7 @@
 
         [Emitted]
         public static void TraceBlockCall(RubyBlockScope/*!*/ scope, BlockParam/*!*/ block, string fileName, int lineNumber) {
-            if (block.ModuleDeclaration != null) {
+            if (block.ModuleDeclaration != null && block.SuperMethodName != null) {
                 scope.ExecutionContext.MethodCalled(scope, block.ModuleDeclaration, block.SuperMethodName, fileName, lineNumber);
             }
         }
===================================================================
