本文整理汇总了C#中IronRuby.Builtins.RubyModule.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# RubyModule.GetName方法的具体用法?C# RubyModule.GetName怎么用?C# RubyModule.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Builtins.RubyModule
的用法示例。
在下文中一共展示了RubyModule.GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefineMethod
private static void DefineMethod(RubyScope/*!*/ scope, RubyModule/*!*/ self, string/*!*/ methodName, RubyMemberInfo/*!*/ info,
RubyModule/*!*/ targetConstraint) {
// MRI: doesn't create a singleton method if module_function is used in the scope, however the the private visibility is applied
var attributesScope = scope.GetMethodAttributesDefinitionScope();
bool isModuleFunction = (attributesScope.MethodAttributes & RubyMethodAttributes.ModuleFunction) == RubyMethodAttributes.ModuleFunction;
var visibility = isModuleFunction ? RubyMethodVisibility.Private : attributesScope.Visibility;
using (self.Context.ClassHierarchyLocker()) {
// MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
if (!self.HasAncestorNoLock(targetConstraint)) {
throw RubyExceptions.CreateTypeError(
String.Format("bind argument must be a subclass of {0}", targetConstraint.GetName(scope.RubyContext))
);
}
self.SetDefinedMethodNoEventNoLock(self.Context, methodName, info, visibility);
}
self.Context.MethodAdded(self, methodName);
}
示例2: DefineMethod
private static void DefineMethod(RubyScope/*!*/ scope, RubyModule/*!*/ self, string/*!*/ methodName, RubyMemberInfo/*!*/ info,
RubyModule/*!*/ targetConstraint) {
var visibility = GetDefinedMethodVisibility(scope, self, methodName);
using (self.Context.ClassHierarchyLocker()) {
// MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
if (!self.HasAncestorNoLock(targetConstraint)) {
throw RubyExceptions.CreateTypeError(
"bind argument must be a subclass of {0}", targetConstraint.GetName(scope.RubyContext)
);
}
self.SetDefinedMethodNoEventNoLock(self.Context, methodName, info, visibility);
}
self.MethodAdded(methodName);
}
示例3: ToS
internal static MutableString/*!*/ ToS(RubyContext/*!*/ context, string/*!*/ methodName, RubyModule/*!*/ declaringModule, RubyModule/*!*/ targetModule,
string/*!*/ classDisplayName) {
MutableString result = MutableString.CreateMutable();
result.Append("#<");
result.Append(classDisplayName);
result.Append(": ");
if (ReferenceEquals(targetModule, declaringModule)) {
result.Append(declaringModule.GetName(context));
} else {
result.Append(targetModule.GetName(context));
result.Append('(');
result.Append(declaringModule.GetName(context));
result.Append(')');
}
result.Append('#');
result.Append(methodName);
result.Append('>');
return result;
}