Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up the Hello World sample

Signed-off-by: Jimmy Schementi <jschementi@gmail.com>
  • Loading branch information...
commit 1fb4020a5d2e4d7dbbecfd4ae449b5b4de71baad 1 parent 1c96eb5
@casualjim casualjim authored committed
View
16 IronRubyMvc.Tests/Core/RouteCollectionSpec.cs
@@ -12,8 +12,8 @@
namespace System.Web.Mvc.IronRuby.Tests.Core
{
- [Concern(typeof (RubyRouteCollection))]
- public class when_a_value_is_mapped : InstanceContextSpecification<RubyRouteCollection>
+ [Concern(typeof (RubyRoutes))]
+ public class when_a_value_is_mapped : InstanceContextSpecification<RubyRoutes>
{
private RouteCollection _routeCollection;
@@ -26,9 +26,9 @@ protected override void EstablishContext()
_routeCollection = routes;
}
- protected override RubyRouteCollection CreateSut()
+ protected override RubyRoutes CreateSut()
{
- return new RubyRouteCollection(new RouteCollection());
+ return new RubyRoutes(new RouteCollection());
}
protected override void Because()
@@ -44,8 +44,8 @@ public void then_it_should_have_a_mapping()
}
}
- [Concern(typeof (RubyRouteCollection))]
- public class when_more_values_are_mapped : InstanceContextSpecification<RubyRouteCollection>
+ [Concern(typeof (RubyRoutes))]
+ public class when_more_values_are_mapped : InstanceContextSpecification<RubyRoutes>
{
private RouteCollection _routeCollection;
@@ -58,9 +58,9 @@ protected override void EstablishContext()
_routeCollection = routes;
}
- protected override RubyRouteCollection CreateSut()
+ protected override RubyRoutes CreateSut()
{
- return new RubyRouteCollection(new RouteCollection());
+ return new RubyRoutes(new RouteCollection());
}
protected override void Because()
View
2  IronRubyMvc.Tests/Core/RubyEngineSpec.cs
@@ -69,7 +69,7 @@ public void it_should_have_a_global_routes_variable()
[Observation]
public void routes_should_be_a_ruby_route_collection()
{
- _engine.Context.GetGlobalVariable("routes").ShouldBeAnInstanceOf<RubyRouteCollection>();
+ _engine.Context.GetGlobalVariable("routes").ShouldBeAnInstanceOf<RubyRoutes>();
}
[Observation]
View
15 IronRubyMvc/Controllers/RubyController.cs
@@ -10,9 +10,6 @@
using System.Web.Routing;
using IronRuby.Builtins;
using Microsoft.Scripting;
-using RubyModuleDefinition = IronRuby.Runtime.RubyModuleAttribute;
-using RubyClassDefinition = IronRuby.Runtime.RubyClassAttribute;
-using RubyMethodDefinition = IronRuby.Runtime.RubyMethodAttribute;
#endregion
@@ -20,22 +17,10 @@ namespace System.Web.Mvc.IronRuby.Controllers
{
public class RubyController : Controller
{
- private static RubyArray _filters = new RubyArray();
private readonly Dictionary<object, object> _viewData = new Dictionary<object, object>();
-
private IRubyEngine _engine;
private IDictionary<object, object> _params;
- public static RubyArray Filters
- {
- get
- {
- if (_filters == null)
- _filters = new RubyArray();
- return _filters;
- }
- }
-
public string ControllerName { get; internal set; }
public RubyClass RubyType { get; private set; }
View
6 IronRubyMvc/Controllers/RubyControllerFactory.cs
@@ -22,19 +22,17 @@ internal RubyControllerFactory(IControllerFactory innerFactory, IRubyEngine engi
public IController CreateController(RequestContext requestContext, string controllerName)
{
- IController result;
try
{
return _innerFactory.CreateController(requestContext, controllerName);
}
- catch
+ catch(InvalidOperationException)
{
}
- result = _engine.LoadController(requestContext, controllerName);
+ return _engine.LoadController(requestContext, controllerName);
- return result;
}
public void ReleaseController(IController controller)
View
24 IronRubyMvc/Core/IRubyEngine.cs
@@ -29,25 +29,6 @@ public interface IRubyEngine
RubyController ConfigureController(RubyClass rubyClass, RequestContext requestContext);
/// <summary>
- /// Creates the instance.
- /// </summary>
- /// <typeparam name="TTarget">The type of the target.</typeparam>
- /// <param name="rubyClass">The ruby class.</param>
- /// <param name="args">The args.</param>
- /// <returns></returns>
- TTarget CreateInstance<TTarget>(RubyClass rubyClass, params object[] args);
-
- /// <summary>
- /// Creates the instance.
- /// </summary>
- /// <typeparam name="TTarget">The type of the target.</typeparam>
- /// <param name="rubyClass">The ruby class.</param>
- /// <param name="throwError">if set to <c>true</c> [throw error].</param>
- /// <param name="args">The args.</param>
- /// <returns></returns>
- TTarget CreateInstance<TTarget>(RubyClass rubyClass, bool throwError, params object[] args) where TTarget : class;
-
- /// <summary>
/// Calls the method.
/// </summary>
/// <param name="receiver">The receiver.</param>
@@ -72,6 +53,11 @@ public interface IRubyEngine
/// <param name="assembly">The assembly.</param>
void LoadAssembly(Assembly assembly);
+ /// <summary>
+ /// Executes the script.
+ /// </summary>
+ /// <param name="script">The script.</param>
+ /// <returns></returns>
object ExecuteScript(string script);
/// <summary>
View
72 IronRubyMvc/Core/RubyEngine.cs
@@ -113,18 +113,6 @@ public RubyController ConfigureController(RubyClass rubyClass, RequestContext re
return controller;
}
- public TTarget CreateInstance<TTarget>(RubyClass rubyClass, bool throwError, params object[] args) where TTarget : class
- {
- var result = Operations.CreateInstance(rubyClass, args);
- return throwError ? (TTarget) result : result as TTarget;
- }
-
- public TTarget CreateInstance<TTarget>(RubyClass rubyClass, params object[] args)
- {
- return (TTarget) Operations.CreateInstance(rubyClass, args);
- }
-
-
/// <summary>
/// Calls the method.
/// </summary>
@@ -216,62 +204,6 @@ public void LoadAssemblies(params Type[] assemblies)
#endregion
- #region Commented
-
-// public bool VariableExists(string variable)
-// {
-// return GetGlobalVariableName(variable).IsNotNullOrBlank();
-// }
-
-// public string GetGlobalVariableName(string nameProposal)
-// {
-// foreach (var variableName in Runtime.Globals.GetVariableNames())
-// {
-// if (String.Equals(variableName, nameProposal, StringComparison.OrdinalIgnoreCase))
-// return variableName;
-// }
-// return String.Empty;
-// }
-
-// public bool MethodExists(string methodName, RubyClass rubyClass)
-// {
-// return GetMethodName(methodName, rubyClass).IsNotNullOrBlank();
-// }
-
-// public string GetMethodName(string methodName, RubyClass rubyClass)
-// {
-// string result = String.Empty;
-//
-// using (Context.ClassHierarchyLocker())
-// {
-// rubyClass.EnumerateMethods((_, symbolId, __) =>
-// {
-// if (String.Equals(symbolId, methodName,
-// StringComparison.OrdinalIgnoreCase))
-// {
-// result = symbolId;
-// return true;
-// }
-//
-// return false;
-// });
-// }
-// return result;
-// }
-
-// public IList<string> GetMethodNames(RubyClass rubyClass)
-// {
-// return Operations.GetMemberNames(rubyClass);
-// }
-
-// public Func<object> GetDelegate(object obj)
-// {
-// Func<object> func = () => Engine.Operations.Call(obj);
-// return func;
-// }
-
- #endregion
-
private void Initialize()
{
Engine = Ruby.GetEngine(Runtime);
@@ -294,7 +226,7 @@ private void RequireControllerFile()
/// </summary>
/// <param name="controllerName">Name of the controller.</param>
/// <returns></returns>
- public static string GetControllerClassName(string controllerName)
+ private static string GetControllerClassName(string controllerName)
{
return (controllerName.EndsWith("Controller", StringComparison.OrdinalIgnoreCase)
? controllerName
@@ -374,7 +306,7 @@ private static RubyEngine InitializeIronRuby(IPathProvider vpp)
private static void ProcessRubyRoutes(RubyEngine engine, IPathProvider vpp, string routesPath)
{
if (!vpp.FileExists(routesPath)) return;
- var routeCollection = new RubyRouteCollection(RouteTable.Routes);
+ var routeCollection = new RubyRoutes(RouteTable.Routes);
engine.DefineReadOnlyGlobalVariable("routes", routeCollection);
engine.RequireRubyFile(routesPath, ReaderType.File);
}
View
17 IronRubyMvc/Core/RubyMvcApplication.cs
@@ -11,19 +11,16 @@ public class RubyMvcApplication : HttpApplication
// private bool _isFirstRequest;
// private bool _hasBeenReset;
- protected virtual void Application_Start(object sender, EventArgs e)
+ protected void Application_Start(object sender, EventArgs e)
{
RubyEngine.InitializeIronRubyMvc(new VirtualPathProvider(), "~/routes.rb");
+ OnStart();
+ }
+
+ protected virtual void OnStart()
+ {
+ // override this to provide start behavior
}
-// protected virtual void Application_BeginRequest(object sender, EventArgs e)
-// {
-// var rubyEngine = Application["___RubyEngine"] as IRubyEngine;
-// if(rubyEngine.IsNotNull() && !_isFirstRequest && !_hasBeenReset)
-// {
-// rubyEngine.ResetEngine();
-// _hasBeenReset = true;
-// }
-// }
}
}
View
4 IronRubyMvc/Core/RubyRouteCollection.cs → IronRubyMvc/Core/RubyRoutes.cs
@@ -8,11 +8,11 @@
namespace System.Web.Mvc.IronRuby.Core
{
- public class RubyRouteCollection
+ public class RubyRoutes
{
private readonly RouteCollection routes;
- public RubyRouteCollection(RouteCollection routes)
+ public RubyRoutes(RouteCollection routes)
{
this.routes = routes;
}
View
114 IronRubyMvc/GlobalSuppressions.cs
@@ -1,108 +1,18 @@
-// This file is used by Code Analysis to maintain SuppressMessage
-// attributes that are applied to this project.
-// Project-level suppressions either have no target or are given
-// a specific target and scoped to a namespace, type, member, etc.
-//
-// To add a suppression to this file, right-click the message in the
-// Error List, point to "Suppress Message(s)", and click
-// "In Project Suppression File".
-// You do not need to add suppressions to this file manually.
-
#region Usings
using System.Diagnostics.CodeAnalysis;
#endregion
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Scope = "member",
- Target =
- "System.Web.Mvc.TempDataDictionary.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Object>>.Contains(System.Collections.Generic.KeyValuePair`2<System.String,System.Object>)"
- ,
- Justification = "There are no defined scenarios for wanting to derive from this class, but we don't want to prevent it either.")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Scope = "member",
- Target =
- "System.Web.Mvc.TempDataDictionary.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Object>>.CopyTo(System.Collections.Generic.KeyValuePair`2<System.String,System.Object>[],System.Int32)"
- ,
- Justification = "There are no defined scenarios for wanting to derive from this class, but we don't want to prevent it either.")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Scope = "member",
- Target = "System.Web.Mvc.TempDataDictionary.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Object>>.IsReadOnly",
- Justification = "There are no defined scenarios for wanting to derive from this class, but we don't want to prevent it either.")]
-[assembly: SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
- Justification = "The referenced assembly is bin-deployable, so we do not have an SP1 dependency.")]
-[assembly: SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
- Justification = "The referenced assembly is bin-deployable, so we do not have an SP1 dependency.")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1061:UseOnlyApiFromTargetedFramework", MessageId = "System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
- Justification = "The referenced assembly is bin-deployable, so we do not have an SP1 dependency.")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Scope = "member", Target = "IronRubyMvcLibrary.Controllers.RubyController.#View", Justification = "Hiding is intended")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "IronRubyMvcLibrary.Helpers",
- Justification = "Helpers reside within a separate namespace to support alternate helper classes.")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "IronRubyMvcLibrary.ViewEngine",
- Justification = "View Engines reside within a separate namespace to support alternate view engines classes.")]
-[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E", Scope = "member", Target = "IronRubyMvcLibrary.Helpers.RubyUrlHelper.#E(System.Object)")]
-[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E", Scope = "member", Target = "IronRubyMvcLibrary.Helpers.RubyUrlHelper.#E(System.String)")]
-[assembly: SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Scope = "type", Target = "IronRubyMvcLibrary.Routing.RubyRouteCollection")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "1#", Scope = "member",
- Target = "IronRubyMvcLibrary.Routing.RubyRouteCollection.#MapRoute(System.String,System.String)")]
-[assembly: SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Scope = "type", Target = "IronRubyMvcLibrary.Core.RubyRouteCollection")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "1#", Scope = "member",
- Target = "IronRubyMvcLibrary.Core.RubyRouteCollection.#MapRoute(System.String,System.String)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "1#", Scope = "member",
- Target = "IronRubyMvcLibrary.Core.RubyRouteCollection.#MapRoute(System.String,System.String,System.Collections.IDictionary)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "1#", Scope = "member",
- Target = "IronRubyMvcLibrary.Core.RubyRouteCollection.#MapRoute(System.String,System.String,System.Collections.IDictionary,System.Collections.IDictionary)")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Scope = "member", Target = "IronRubyMvcLibrary.Controllers.RubyController.#View(System.Object)")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Scope = "member", Target = "IronRubyMvcLibrary.Controllers.RubyController.#View(System.String,System.Object)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member",
- Target = "IronRubyMvcLibrary.Controllers.RubyControllerFactory.#CreateController(System.Web.Routing.RequestContext,System.String)")]
-[assembly: SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Scope = "member", Target = "IronRubyMvcLibrary.Core.DefaultScriptRunner.#Execute()")]
-[assembly:
- SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers", Scope = "member",
- Target = "IronRubyMvcLibrary.Core.RubyMvcApplication.#Application_Start(System.Object,System.EventArgs)")]
-[assembly: SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Scope = "member", Target = "IronRubyMvcLibrary.Core.ScopedScriptRunner.#Execute()")]
-[assembly: SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Scope = "member", Target = "IronRubyMvcLibrary.Extensions.Inflector.#.cctor()")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member",
- Target = "IronRubyMvcLibrary.ViewEngine.RubyView.#LoadHelpers(Microsoft.Scripting.Hosting.ScriptEngine,Microsoft.Scripting.Hosting.ScriptScope,System.IO.TextWriter)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member",
- Target = "IronRubyMvcLibrary.ViewEngine.RubyView.#Render(System.Web.Mvc.ViewContext,System.IO.TextWriter)")]
-[assembly:
- SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration", MessageId = "0#", Scope = "member",
- Target = "IronRubyMvcLibrary.ViewEngine.RubyView.#Render(System.Web.Mvc.ViewContext,System.IO.TextWriter)")]
-[assembly:
- SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "rubyContext", Scope = "member",
- Target = "IronRubyMvcLibrary.ViewEngine.RubyView.#Render(System.Web.Mvc.ViewContext,System.IO.TextWriter)")]
-[assembly:
- SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "requestContext", Scope = "member",
- Target = "IronRubyMvcLibrary.ViewEngine.RubyViewEngine.#GetView(System.Web.Mvc.ControllerContext,System.String,IronRubyMvcLibrary.ViewEngine.RubyView)")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "IronRubyMvcLibrary.Controllers")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member",
- Target = "IronRubyMvcLibrary.Extensions.DictionaryExtensions.#ToFilters`3(System.Collections.IDictionary)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member",
- Target = "IronRubyMvcLibrary.Core.IRubyEngine.#CreateInstance`1(IronRuby.Builtins.RubyClass,System.Object[])")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member",
- Target = "IronRubyMvcLibrary.Core.RubyEngine.#CreateInstance`1(IronRuby.Builtins.RubyClass,System.Object[])")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member",
- Target = "IronRubyMvcLibrary.Extensions.DictionaryExtensions.#ToFilters`3(System.Collections.IDictionary,IronRubyMvcLibrary.Core.IRubyEngine)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "IronRubyMvcLibrary.Core.IRubyEngine.#LoadFilter`1(IronRuby.Builtins.RubyClass)")]
-[assembly:
- SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "IronRubyMvcLibrary.Core.RubyEngine.#LoadFilter`1(IronRuby.Builtins.RubyClass)")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "IronRubyMvcLibrary.Core.IRubyEngine.#LoadFilter`1(System.String)")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Scope = "member", Target = "IronRubyMvcLibrary.Core.RubyEngine.#LoadFilter`1(System.String)")]
-[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "IronRubyMvcLibrary.Core.TestSupport")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Mvc.IronRuby.Helpers")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.Web.Mvc.IronRuby.ViewEngine")]
+[assembly: SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
+[assembly: SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework", MessageId = "System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")]
+[assembly: SuppressMessage("Microsoft.Design",
+ "CA1061:DoNotHideBaseClassMethods",
+ Scope = "member",
+ Target = "System.Web.Mvc.IronRuby.Controllers.RubyController.#View(System.Object)",
+ Justification = "Hiding is intended")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1061:DoNotHideBaseClassMethods", Scope = "member", Target = "System.Web.Mvc.IronRuby.Controllers.RubyController.#View(System.String,System.Object)", Justification = "Hiding is intended")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E", Scope = "member", Target = "System.Web.Mvc.IronRuby.Helpers.RubyUrlHelper.#E(System.Object)")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "E", Scope = "member", Target = "System.Web.Mvc.IronRuby.Helpers.RubyUrlHelper.#E(System.String)")]
View
2  IronRubyMvc/System.Web.Mvc.IronRuby.csproj
@@ -92,7 +92,7 @@
<Compile Include="Core\Constants.cs" />
<Compile Include="Core\Enums.cs" />
<Compile Include="Core\RubyMvcApplication.cs" />
- <Compile Include="Core\RubyRouteCollection.cs" />
+ <Compile Include="Core\RubyRoutes.cs" />
<Compile Include="Controllers\RubyActionDescriptor.cs" />
<Compile Include="Controllers\RubyController.cs" />
<Compile Include="Controllers\RubyControllerActionInvoker.cs" />
View
12 IronRubyMvcWeb/Controllers/Helpers/BaseController.rb
@@ -1,22 +1,16 @@
-require 'IronRubyMvcWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
+require 'IronRubyMvcWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
class BaseController < Controller
- def initialize(context = nil)
- if(context != nil)
- base.Initialize(context)
- end
- end
-
def fill_view_data
instance_variables.each { |varname| view_data.Add(varname[1..-1], instance_variable_get(varname.to_sym)) }
end
def to_decimal(value)
- System::Convert::ToDecimal value
+ System::Convert::ToDecimal value
end
def return_view(*args)
fill_view_data
- view *args
+ view args
end
end
View
19 IronRubyMvcWeb/Controllers/HomeController.rb
@@ -1,25 +1,18 @@
-#require "HomeModel"
+require "HomeModel"
require 'MyFilter'
-class HomeModel
- def salutation
- "ASP.NET MVC <3 IronRuby!!!"
- end
-end
+#class HomeModel
+# def salutation
+# "ASP.NET MVC <3 IronRuby!!!"
+# end
+#end
class HomeController < Controller
- # def initialize(context = nil)
- # if(context != nil)
- # super.Initialize(context)
- # end
- # end
before_action :index do |context|
- $before_counter ||= 0
- $before_counter += 1
context.request_context.http_context.response.write("Hello world<br />")
end
View
26 IronRubyMvcWeb/Controllers/ProductsController.rb
@@ -1,31 +1,9 @@
-#require 'helpers/BaseController'
-#require 'ProductsRepository'
-
-require 'IronRubyMvcWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
-include IronRubyMvcWeb::Models
-include IronRubyMvcWeb::Models::Northwind
+require 'helpers/BaseController'
+require 'ProductsRepository'
require 'MyProductFilter'
require 'MyControllerFilter'
-class ProductsRepository < IronRubyRepository
-end
-
-class BaseController < Controller
-
- def fill_view_data
- instance_variables.each { |varname| view_data.Add(varname[1..-1], instance_variable_get(varname.to_sym)) }
- end
-
- def to_decimal(value)
- System::Convert::ToDecimal value
- end
-
- def return_view(*args)
- fill_view_data
- view args
- end
-end
class ProductsController < Controller
View
2  IronRubyMvcWeb/Models/Helpers/model.rb
@@ -1,2 +1,2 @@
-include IronRubyMvcWeb::Models
+include IronRubyMvcWeb::Models
include IronRubyMvcWeb::Models::Northwind
View
2  IronRubyMvcWeb/Models/HomeModel.rb
@@ -1,4 +1,4 @@
-class HomeModel
+class HomeModel
def salutation
"ASP.NET MVC <3 IronRuby!!!"
end
View
2  IronRubyMvcWeb/Models/ProductsRepository.rb
@@ -1,4 +1,4 @@
-require 'helpers/model'
+require 'helpers/model'
class ProductsRepository < IronRubyRepository
end
Please sign in to comment.
Something went wrong with that request. Please try again.