本文整理汇总了C#中IronRuby.Builtins.RubyModule类的典型用法代码示例。如果您正苦于以下问题:C# RubyModule类的具体用法?C# RubyModule怎么用?C# RubyModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RubyModule类属于IronRuby.Builtins命名空间,在下文中一共展示了RubyModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RubyOverloadGroupInfo
internal RubyOverloadGroupInfo(OverloadInfo/*!*/[]/*!*/ methods, RubyModule/*!*/ declaringModule,
RubyOverloadGroupInfo/*!*/[] overloadOwners, bool isStatic)
: base(methods, declaringModule, isStatic) {
Debug.Assert(overloadOwners == null || methods.Length == overloadOwners.Length);
_overloadOwners = overloadOwners;
}
示例2: RubyLambdaMethodInfo
internal RubyLambdaMethodInfo(Proc/*!*/ block, string/*!*/ definitionName, RubyMemberFlags flags, RubyModule/*!*/ declaringModule)
: base(flags, declaringModule) {
Assert.NotNull(block, definitionName, declaringModule);
_lambda = block.ToLambda(this);
_definitionName = definitionName;
_id = Interlocked.Increment(ref _Id);
}
示例3: DefineGlobalClass
protected RubyClass/*!*/ DefineGlobalClass(string/*!*/ name, Type/*!*/ type, RubyClass/*!*/ super,
Action<RubyModule> instanceTrait, Action<RubyModule> classTrait, RubyModule[]/*!*/ mixins, Delegate[] factories) {
RubyClass result = _context.DefineLibraryClass(name, type, instanceTrait, classTrait, super, mixins, factories, _builtin);
_context.ObjectClass.SetConstant(result.Name, result);
return result;
}
示例4: get_property_by_name
public static Object get_property_by_name(RubyModule/*!*/ self, [NotNull]String/*!*/ name)
{
if(name == "platform") return "WP7";
else if(name == "os_version") return "7.0";
else if(name == "country") return "us";
else return "";
}
示例5: MethodResolutionResult
public MethodResolutionResult(RubyMemberInfo/*!*/ info, RubyModule/*!*/ owner, bool visible)
{
Assert.NotNull(info, owner);
_info = info;
_owner = owner;
_visible = visible;
}
示例6: UnboundMethod
internal UnboundMethod(RubyModule/*!*/ targetConstraint, string/*!*/ name, RubyMemberInfo/*!*/ info) {
Assert.NotNull(targetConstraint, name, info);
_name = name;
_info = info;
_targetConstraint = targetConstraint;
}
示例7: AreIdentical
public static bool AreIdentical(RubyModule/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path1, [DefaultProtocol, NotNull]MutableString/*!*/ path2) {
FileSystemInfo info1, info2;
return RubyFileOps.RubyStatOps.TryCreate(self.Context, self.Context.DecodePath(path1), out info1)
&& RubyFileOps.RubyStatOps.TryCreate(self.Context, self.Context.DecodePath(path2), out info2)
&& RubyFileOps.RubyStatOps.AreIdentical(self.Context, info1, info2);
}
示例8: RubyMethodGroupInfo
// copy ctor
private RubyMethodGroupInfo(RubyMethodGroupInfo/*!*/ info, RubyMemberFlags flags, RubyModule/*!*/ module)
: base(info.MethodBases, flags, module) {
_isStatic = info._isStatic;
_hasVirtuals = info._hasVirtuals;
_staticDispatchMethods = info._staticDispatchMethods;
// Note: overloadOwners and maxCachedOverloadLevel are cleared whenever the group is copied.
}
示例9: Load
public static object Load(RubyScope/*!*/ scope, RubyModule/*!*/ self, MutableString/*!*/ libraryName)
{
object loaded;
scope.RubyContext.Loader.LoadFile(null, self, libraryName, LoadFlags.ResolveLoaded | LoadFlags.AnyLanguage, out loaded);
Debug.Assert(loaded != null);
return loaded;
}
示例10: AreIdentical
public static bool AreIdentical(ConversionStorage<MutableString>/*!*/ toPath, RubyModule/*!*/ self, object path1, object path2) {
FileSystemInfo info1, info2;
return RubyFileOps.RubyStatOps.TryCreate(self.Context, self.Context.DecodePath(Protocols.CastToPath(toPath, path1)), out info1)
&& RubyFileOps.RubyStatOps.TryCreate(self.Context, self.Context.DecodePath(Protocols.CastToPath(toPath, path2)), out info2)
&& RubyFileOps.RubyStatOps.AreIdentical(self.Context, info1, info2);
}
示例11: EachObject
public static object EachObject(BlockParam block, RubyModule/*!*/ self, [NotNull]RubyClass/*!*/ theClass) {
Type classType = theClass.GetType();
bool isClass = (classType == typeof(RubyClass));
if (!isClass && classType != typeof(RubyModule)) {
throw new NotSupportedException("each_object only supported for objects of type Class or Module");
}
if (block == null) {
throw RubyExceptions.NoBlockGiven();
}
Dictionary<RubyModule, object> visited = new Dictionary<RubyModule, object>();
Stack<RubyModule> modules = new Stack<RubyModule>();
modules.Push(theClass.Context.ObjectClass);
while (modules.Count > 0) {
RubyModule next = modules.Pop();
RubyClass asClass = next as RubyClass;
if (!isClass || asClass != null) {
object result;
if (block.Yield(next, out result)) {
return result;
}
}
next.EnumerateConstants(delegate(RubyModule module, string name, object value) {
RubyModule constAsModule = (value as RubyModule);
if (constAsModule != null && !visited.ContainsKey(constAsModule)) {
modules.Push(constAsModule);
visited[module] = null;
}
return false;
});
}
return visited.Count;
}
示例12: Dump
public static object Dump(WriterSites/*!*/ sites, RubyModule/*!*/ self, object obj, [NotNull]RubyIO/*!*/ io, [Optional]int? limit)
{
BinaryWriter writer = io.GetBinaryWriter();
MarshalWriter dumper = new MarshalWriter(sites, writer, self.Context, limit);
dumper.Dump(obj);
return io;
}
示例13: choose
public static void choose(RubyModule/*!*/ self, params object[] args)
{
try
{
if (args != null && args.Length != 4 && args.Length != 5)
throw RubyExceptionData.InitializeException(new RuntimeError("wrong number of arguments"), "wrong number of arguments");
if (args.Length == 5)
m_opaque = args[4].ToString();
m_fmt = int.Parse(args[3].ToString());
m_callback = args[0].ToString();
m_title = args[1].ToString();
//long init = args[2].toRubyTime().getTime();
RHODESAPP().MainPage.Dispatcher.BeginInvoke(() =>
{
OpenPickerPage();
});
}
catch (Exception ex)
{
Exception rubyEx = self.Context.CurrentException;
if (rubyEx == null)
{
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
}
LOG.ERROR("choose", ex);
throw rubyEx;
}
}
示例14: RubyLibraryMethodInfo
/// <summary>
/// Creates a Ruby method implemented by a method group of CLR methods.
/// </summary>
internal RubyLibraryMethodInfo(LibraryOverload/*!*/[]/*!*/ overloads, RubyMemberFlags flags, RubyModule/*!*/ declaringModule)
: base(null, flags, declaringModule)
{
Assert.NotNullItems(overloads);
Assert.NotEmpty(overloads);
_overloads = overloads;
}
示例15: RubyMethodGroupBase
protected RubyMethodGroupBase(OverloadInfo/*!*/[] methods, RubyMemberFlags flags, RubyModule/*!*/ declaringModule)
: base(flags, declaringModule)
{
if (methods != null) {
SetMethodBasesNoLock(methods);
}
}