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


C# RubyModule.ForEachMember方法代码示例

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


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

示例1: GetMethods

 internal static RubyArray/*!*/ GetMethods(RubyModule/*!*/ self, bool inherited, RubyMethodAttributes attributes) {
     var result = new RubyArray();
     var symbolicNames = self.Context.RubyOptions.Compatibility > RubyCompatibility.Ruby18;
     self.ForEachMember(inherited, attributes, delegate(string/*!*/ name, RubyMemberInfo/*!*/ member) {
         if (symbolicNames) {
             result.Add(SymbolTable.StringToId(name));
         } else {
             result.Add(MutableString.Create(name));
         }
     });
     return result;
 }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:12,代码来源:ModuleOps.cs

示例2: GetMethods

 internal static RubyArray/*!*/ GetMethods(RubyModule/*!*/ self, bool inherited, RubyMethodAttributes attributes) {
     var result = new RubyArray();
     self.ForEachMember(inherited, attributes, delegate(string/*!*/ name, RubyMemberInfo/*!*/ member) {
         result.Add(MutableString.Create(name));
     });
     return result;
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:7,代码来源:ModuleOps.cs

示例3: GetMethodDefinitions

        /// <summary>
        /// メソッド定義情報を取得する。
        /// </summary>
        /// <param name="constant">モジュールまたはクラスのRubyオブジェクト。</param>
        /// <param name="attributes">メソッド取得対象を表すスイッチ。</param>
        /// <param name="objectDefinition">オブジェクト定義のインスタンス。</param>
        /// <param name="singleton">シングルトンメソッドか?</param>
        private static void GetMethodDefinitions(
            RubyModule constant,
            RubyMethodAttributes attributes,
            RubyObjectDefinition objectDefinition,
            bool singleton)
        {
            constant.ForEachMember(false, attributes | RubyMethodAttributes.VisibilityMask, (methodName, module, memberInfo) =>
            {
                if (memberInfo is RubyAttributeAccessorInfo)
                {
                    var accessorInfo = (RubyAttributeAccessorInfo)memberInfo;
                    var accessorName = methodName;

                    if (accessorInfo is RubyAttributeWriterInfo)
                    {
                        accessorName = accessorName.Substring(0, accessorName.Length - 1);
                    }

                    var accessorDefinition = (
                        from a in objectDefinition.Accessors
                        where a.Name == accessorName
                        select a
                    ).FirstOrDefault();

                    if (accessorDefinition == null)
                    {
                        accessorDefinition = new RubyAccessorDefinition()
                        {
                            Name = accessorName
                        };

                        objectDefinition.Accessors.Add(accessorDefinition);
                    }

                    if (accessorInfo is RubyAttributeWriterInfo)
                    {
                        accessorDefinition.Writable = true;
                    }
                    else if (accessorInfo is RubyAttributeReaderInfo)
                    {
                        accessorDefinition.Readable = true;
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                }
                else if (memberInfo is RubyMethodInfo)
                {
                    var methodInfo = (RubyMethodInfo)memberInfo;

                    var methodDefinition = new RubyMethodDefinition()
                    {
                        Name = methodName,
                        Singleton = singleton
                    };

                    foreach (LocalVariable argument in methodInfo.Parameters.Mandatory)
                    {
                        methodDefinition.Arguments.Add(
                            new RubyMethodArgumentDefinition()
                            {
                                Name = argument.Name,
                                Optional = false
                            }
                        );
                    }
                    foreach (SimpleAssignmentExpression argument in methodInfo.Parameters.Optional)
                    {
                        var argumentDefinition = new RubyMethodArgumentDefinition()
                        {
                            Name = ((LocalVariable)argument.Left).Name,
                            Optional = true
                        };

                        if (argument.Right is Literal)
                        {
                            argumentDefinition.DefaultValue = ((Literal)argument.Right).Value;
                        }
                        else if (argument.Right is ClassVariable)
                        {
                            argumentDefinition.DefaultValue = ((ClassVariable)argument.Right).Name;
                            argumentDefinition.ClassVariable = true;
                        }

                        methodDefinition.Arguments.Add(argumentDefinition);
                    }

                    objectDefinition.Methods.Add(methodDefinition);
                }
                else
                {
                    throw new NotImplementedException();
//.........这里部分代码省略.........
开发者ID:RaTTiE,项目名称:Warlock-core,代码行数:101,代码来源:RubyDefinition.cs

示例4: GetMethods

        internal static RubyArray/*!*/ GetMethods(RubyModule/*!*/ self, bool inherited, RubyMethodAttributes attributes,
            IEnumerable<string> foreignMembers) {

            var result = new RubyArray();
            var symbolicNames = self.Context.RubyOptions.Compatibility > RubyCompatibility.Ruby18;

            using (self.Context.ClassHierarchyLocker()) {
                self.ForEachMember(inherited, attributes, foreignMembers, (name, module, member) => {
                    if (member.IsInteropMember && (module.Restrictions & ModuleRestrictions.NoNameMapping) == 0 && RubyUtils.HasMangledName(name)) {
                        result.Add(new ClrName(name));
                    } else {
                        result.Add(CreateMethodName(name, symbolicNames));
                    }
                });
            }
            return result;
        }
开发者ID:atczyc,项目名称:ironruby,代码行数:17,代码来源:ModuleOps.cs

示例5: GetMethods

        internal static RubyArray/*!*/ GetMethods(RubyModule/*!*/ self, bool inherited, RubyMethodAttributes attributes,
            IEnumerable<string> foreignMembers) {

            var result = new RubyArray();
            var symbolicNames = self.Context.RubyOptions.Compatibility > RubyCompatibility.Ruby18;

            using (self.Context.ClassHierarchyLocker()) {
                self.ForEachMember(inherited, attributes, foreignMembers, delegate(string/*!*/ name, RubyMemberInfo member) {
                    result.Add(CreateMethodName(name, symbolicNames));
                });
            }
            return result;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:13,代码来源:ModuleOps.cs

示例6: GetMethods

        internal static RubyArray/*!*/ GetMethods(RubyModule/*!*/ self, bool inherited, RubyMethodAttributes attributes,
            IEnumerable<string> foreignMembers) {

            var result = new RubyArray();
            using (self.Context.ClassHierarchyLocker()) {
                self.ForEachMember(inherited, attributes, foreignMembers, (name, module, member) => {
                    if (member.IsInteropMember && (module.Restrictions & ModuleRestrictions.NoNameMapping) == 0 && RubyUtils.HasMangledName(name)) {
                        if (Tokenizer.IsMethodName(name) || Tokenizer.IsOperatorName(name)) {
                            result.Add(new ClrName(name));
                        }
                    } else {
                        result.Add(self.Context.StringifyIdentifier(name));
                    }
                });
            }
            return result;
        }
开发者ID:jschementi,项目名称:iron,代码行数:17,代码来源:ModuleOps.cs


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