当前位置: 首页>>代码示例>>C#>>正文


C# RubyContext.InitializeGlobalScope方法代码示例

本文整理汇总了C#中RubyContext.InitializeGlobalScope方法的典型用法代码示例。如果您正苦于以下问题:C# RubyContext.InitializeGlobalScope方法的具体用法?C# RubyContext.InitializeGlobalScope怎么用?C# RubyContext.InitializeGlobalScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RubyContext的用法示例。


在下文中一共展示了RubyContext.InitializeGlobalScope方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateWrappedTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateWrappedTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false, false);
            
            RubyModule module = context.CreateModule(null, null, null, null, null, null, null, ModuleRestrictions.None);
            RubyObject mainObject = new RubyObject(context.ObjectClass);
            context.CreateMainSingleton(mainObject, new[] { module });

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, module, null, mainObject);
            scope.SetDebugName("top-level-wrapped");

            return scope;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:12,代码来源:RubyScope.cs

示例2: CreateTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context, bool isMain) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false, false);

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, null, rubyGlobalScope.MainObject);
            if (isMain) {
                scope.SetDebugName("top-main");
                context.ObjectClass.SetConstant("TOPLEVEL_BINDING", new Binding(scope));
                if (context.RubyOptions.RequirePaths != null) {
                    foreach (var path in context.RubyOptions.RequirePaths) {
                        context.Loader.LoadFile(globalScope, rubyGlobalScope.MainObject, MutableString.Create(path, RubyEncoding.UTF8), LoadFlags.Require);
                    }
                }
            } else {
                scope.SetDebugName("top-required");
            }

            return scope;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:18,代码来源:RubyScope.cs

示例3: CreateHostedTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateHostedTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context, bool bindGlobals) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, true, bindGlobals);

            // Reuse existing top-level scope if available:
            RubyTopLevelScope scope = rubyGlobalScope.TopLocalScope;
            if (scope == null) {
                scope = new RubyTopLevelScope(
                    rubyGlobalScope, null, bindGlobals ? rubyGlobalScope.MainSingleton : null, rubyGlobalScope.MainObject
                );

                scope.SetDebugName(bindGlobals ? "top-level-bound" : "top-level");
                rubyGlobalScope.SetTopLocalScope(scope);
            } else {
                // If we reuse a local scope from previous execution all local variables are accessed dynamically.
                // Therefore we shouldn't have any new static local variables.
            }

            return scope;
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:19,代码来源:RubyScope.cs

示例4: CreateWrappedTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateWrappedTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context) {
            RubyModule module = context.CreateModule(null, null, null, null, null, null, null);
            object mainObject = new Object();
            RubyClass mainSingleton = context.CreateMainSingleton(mainObject, new[] { module });

            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false);
            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, module, new RuntimeFlowControl(), mainObject);
            scope.SetDebugName("top-level-wrapped");

            return scope;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:11,代码来源:RubyScope.cs

示例5: CreateTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false);

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, new RuntimeFlowControl(), rubyGlobalScope.MainObject);
            scope.SetDebugName("top-level");

            return scope;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:8,代码来源:RubyScope.cs

示例6: CreateTopLevelHostedScope

        internal static RubyTopLevelScope/*!*/ CreateTopLevelHostedScope(Scope/*!*/ globalScope, RubyContext/*!*/ context) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, true);

            // Reuse existing top-level scope if available:
            RubyTopLevelScope scope = rubyGlobalScope.TopLocalScope;
            if (scope == null) {
                scope = new RubyTopLevelScope(rubyGlobalScope, null, new RuntimeFlowControl(), rubyGlobalScope.MainObject);
                scope.SetDebugName("top-level-hosted");
                rubyGlobalScope.TopLocalScope = scope;
            } else {
                // If we reuse a local scope from previous execution all local variables are accessed dynamically.
                // Therefore we shouldn't have any new static local variables.
            }

            return scope;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:16,代码来源:RubyScope.cs

示例7: CreateMainTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateMainTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false);

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, new RuntimeFlowControl(), rubyGlobalScope.MainObject);
            scope.SetDebugName("top-main");
            context.ObjectClass.SetConstant("TOPLEVEL_BINDING", new Binding(scope));

            return scope;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:9,代码来源:RubyScope.cs

示例8: CreateTopLevelScope

        internal static RubyTopLevelScope/*!*/ CreateTopLevelScope(Scope/*!*/ globalScope, RubyContext/*!*/ context, bool isMain) {
            RubyGlobalScope rubyGlobalScope = context.InitializeGlobalScope(globalScope, false, false);

            RubyTopLevelScope scope = new RubyTopLevelScope(rubyGlobalScope, null, null, rubyGlobalScope.MainObject);
            if (isMain) {
                scope.SetDebugName("top-main");
                context.ObjectClass.SetConstant("TOPLEVEL_BINDING", new Binding(scope));
            } else {
                scope.SetDebugName("top-required");
            }

            return scope;
        }
开发者ID:bclubb,项目名称:ironruby,代码行数:13,代码来源:RubyScope.cs


注:本文中的RubyContext.InitializeGlobalScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。