-
Notifications
You must be signed in to change notification settings - Fork 6
/
IRubyEngine.cs
153 lines (133 loc) · 5.26 KB
/
IRubyEngine.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#region Usings
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Web.Mvc.IronRuby.Controllers;
using System.Web.Routing;
using IronRuby.Builtins;
using Microsoft.Scripting.Hosting;
#endregion
namespace System.Web.Mvc.IronRuby.Core
{
/// <summary>
/// A facade over the classes for interacting with the IronRuby runtime
/// </summary>
public interface IRubyEngine
{
// /// <summary>
// /// Loads the controller.
// /// </summary>
// /// <param name="requestContext">The request context.</param>
// /// <param name="controllerName">Name of the controller.</param>
// /// <returns></returns>
// RubyController LoadController(RequestContext requestContext, string controllerName);
//
// /// <summary>
// /// Configures the controller.
// /// </summary>
// /// <param name="rubyClass">The ruby class.</param>
// /// <param name="requestContext">The request context.</param>
// /// <returns></returns>
// RubyController ConfigureController(RubyClass rubyClass, RequestContext requestContext);
/// <summary>
/// Calls the method.
/// </summary>
/// <param name="receiver">The receiver.</param>
/// <param name="message">The message.</param>
/// <param name="args">The args.</param>
/// <returns></returns>
object CallMethod(object receiver, string message, params object[] args);
// /// <summary>
// /// Determines whether the specified controller as the action.
// /// </summary>
// /// <param name="controller">The controller.</param>
// /// <param name="actionName">Name of the action.</param>
// /// <returns>
// /// <c>true</c> if the specified controller has the action; otherwise, <c>false</c>.
// /// </returns>
// bool HasControllerAction(RubyController controller, string actionName);
/// <summary>
/// Gets the method names for the controller class.
/// </summary>
/// <param name="controller">The controller.</param>
/// <returns></returns>
IEnumerable<string> MethodNames(IController controller);
/// <summary>
/// Methods the names.
/// </summary>
/// <param name="controllerClass">The controller class.</param>
/// <returns></returns>
IEnumerable<string> MethodNames(RubyClass controllerClass);
/// <summary>
/// Loads the assembly.
/// </summary>
/// <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>
/// Executes the script.
/// </summary>
/// <param name="script">The script.</param>
/// <param name="scope">The scope.</param>
/// <returns></returns>
object ExecuteScript(string script, ScriptScope scope);
/// <summary>
/// Defines the read only global variable.
/// </summary>
/// <param name="variableName">Name of the variable.</param>
/// <param name="value">The value.</param>
void DefineReadOnlyGlobalVariable(string variableName, object value);
/// <summary>
/// Removes the class from globals.
/// </summary>
/// <param name="className">Name of the class.</param>
void RemoveClassFromGlobals(string className);
/// <summary>
/// Creates an instance of a ruby object.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="rubyClass">The ruby class.</param>
/// <returns></returns>
T CreateInstance<T>(RubyClass rubyClass);
/// <summary>
/// Gets the ruby class.
/// </summary>
/// <param name="className">Name of the class.</param>
/// <returns></returns>
RubyClass GetRubyClass(string className);
/// <summary>
/// Gets the global variable.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="name">The name.</param>
/// <returns></returns>
[SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
T GetGlobalVariable<T>(string name);
/// <summary>
/// Loads the assemblies.
/// </summary>
/// <param name="assemblies">The assemblies.</param>
void LoadAssemblies(params Type[] assemblies);
/// <summary>
/// Executes the block in scope.
/// </summary>
/// <param name="block">The block.</param>
void ExecuteInScope(Action<ScriptScope> block);
/// <summary>
/// Requires the ruby file.
/// </summary>
/// <param name="path">The path.</param>
void RequireRubyFile(string path);
/// <summary>
/// Requires the ruby file.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="readerType">Type of the reader.</param>
void RequireRubyFile(string path, ReaderType readerType);
}
}