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


C# RubyArray类代码示例

本文整理汇总了C#中RubyArray的典型用法代码示例。如果您正苦于以下问题:C# RubyArray类的具体用法?C# RubyArray怎么用?C# RubyArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: dosync

        public static object dosync(RubyModule/*!*/ self, RubyArray args)
        {
            object res = null;
            try
            {
                boolean bShowStatus = true;	
                String query_params = "";
                if ( args != null && args.Count > 0 )	
                {
                    String str = ((MutableString)args[0]).ToString();	
                    //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);	
                    bShowStatus = "true".equalsIgnoreCase(str);	
                }
        
                if (args != null && args.Count > 1)
                    query_params = ((MutableString)args[1]).ToString();
                
                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, bShowStatus, query_params));

                res = SyncThread.getInstance().getRetValue();
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("dosync", ex);
                throw rubyEx;
            }

            return res;
        }
开发者ID:javiermurillo,项目名称:rhodes,代码行数:34,代码来源:RhoSyncEngine.cs

示例2: CreateBacktrace

        // Called lazily to create a Ruby backtrace.
        private void CreateBacktrace() {
            RubyArray result;

            int skipFrames = 0;
            bool hasFileAccessPermissions = DetectFileAccessPermissions();

#if SILVERLIGHT // TODO: StackTrace.ctor(exception) security critical
            // throw-site trace is built already:
            result = _backtrace ?? new RubyArray();
#else
            result = new RubyArray();
            if (_throwSiteTrace == null) {
                SetCompiledTrace();
            }

            AddBacktrace(result, _throwSiteTrace.GetFrames(), hasFileAccessPermissions, skipFrames);
#endif
            if (_catchSiteTrace != null) {
                // skip one frame - the catch-site frame is already included
                AddBacktrace(result, _catchSiteTrace.GetFrames(), hasFileAccessPermissions, 1);
            }

            _backtrace = result;
            _backtraceInitialized = true;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:26,代码来源:RubyExceptionData.cs

示例3: GetMembers

 internal RubyArray/*!*/ GetMembers() {
     RubyArray list = new RubyArray(Members.Length);
     foreach (string id in Members) {
         list.Add(MutableString.Create(id));
     }
     return list;
 }
开发者ID:joshholmes,项目名称:ironruby,代码行数:7,代码来源:RubyStruct.cs

示例4: RhoParamArray

 public RhoParamArray(RhoParams oParams, String name) : base(oParams)
 {
     m_array = null;
     Object ar = findHashParam(name);
     if (ar != null && (ar is RubyArray))
         m_array = (RubyArray)ar;    
 }
开发者ID:arissetyawan,项目名称:rhodes,代码行数:7,代码来源:RhoParamArray.cs

示例5: GetMembers

 internal RubyArray/*!*/ GetMembers(RubyContext/*!*/ context) {
     RubyArray list = new RubyArray(_names.Length);
     foreach (string id in _names) {
         list.Add(context.StringifyIdentifier(id));
     }
     return list;
 }
开发者ID:BrianGenisio,项目名称:ironruby,代码行数:7,代码来源:RubyStruct.cs

示例6: Script

 public Script(RubyArray rmScript)
 {
     _rmScript = rmScript;
       _section = (int)_rmScript[0];
       _name = Ruby.ConvertString((MutableString)_rmScript[1]);
       UpdateTabName();
 }
开发者ID:revam,项目名称:Gemini,代码行数:7,代码来源:Script.cs

示例7: ToYamlNode

 public static Node ToYamlNode(RubyContext/*!*/ context, RubyArray/*!*/ self, [NotNull]RubyRepresenter/*!*/ rep)
 {
     return rep.Sequence(
         rep.GetTagUri(self, Tags.Seq, typeof(RubyArray)),
         self,
         rep.GetYamlStyle(self) != ScalarQuotingStyle.None ? FlowStyle.Inline : FlowStyle.Block
     );
 }
开发者ID:TerabyteX,项目名称:main,代码行数:8,代码来源:BuiltinsOps.cs

示例8: GetMembers

 internal RubyArray/*!*/ GetMembers() {
     RubyArray list = new RubyArray(_names.Length);
     foreach (string id in _names) {
         // TODO: we need to add encoding to symbols and preserve it here:
         list.Add(MutableString.Create(id, RubyEncoding.UTF8));
     }
     return list;
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:8,代码来源:RubyStruct.cs

示例9: Create

        public static void Create(RubyModule/*!*/ self, int barType, RubyArray args)
        {
            if (args != null && args.Count > 0)
                RhodesApp.createToolBar(barType, (Object)args);

            if (barType == 2)
                RhodesApp.removeToolBar();
        }
开发者ID:douglaslise,项目名称:rhodes,代码行数:8,代码来源:RhoNativeBar.cs

示例10: Execute

            public static RubyArray Execute(RhoDatabase/*!*/ self, MutableString/*!*/ sqlStatement, Boolean isBatch, RubyArray args)
            {
                try
                {
                    RubyArray retArr = new RubyArray();

                    if (isBatch)
                    {
                        self.m_db.executeBatchSQL(sqlStatement.ToString());
                    }
                    else
                    {
                        Object[] values = null;
                        if (args != null && args.Count > 0)
                        {
                            if (args[0] != null && args[0] is RubyArray)
                                values = ((RubyArray)args[0]).ToArray();
                            else
                                values = args.ToArray();
                        }

                        try
                        {
                            self.m_db.Lock();
                            using (IDBResult rows = self.m_db.executeSQL(sqlStatement.ToString(), values, true))
                            {
                                if (rows != null)
                                {
                                    MutableString[] colNames = null;
                                    for (; !rows.isEnd(); rows.next())
                                    {
                                        IDictionary<object, object> map = new Dictionary<object, object>();
                                        Hash row = new Hash(map);
                                        for (int nCol = 0; nCol < rows.getColCount(); nCol++)
                                        {
                                            if (colNames == null)
                                                colNames = getOrigColNames(rows);

                                            row.Add(colNames[nCol], rows.getRubyValueByIdx(nCol));
                                        }
                                        retArr.Add(row);
                                    }
                                }
                            }
                        }
                        finally
                        {
                            self.m_db.Unlock();
                        }
                    }

                    return retArr;
                }catch (Exception exc)
                {
                    //TODO: throw ruby exception
                    throw exc;
                }
            }
开发者ID:Chanic,项目名称:rhodes,代码行数:58,代码来源:RhoDatabase.cs

示例11: Accept

 public static RubyArray Accept(RubyContext/*!*/ context, RubySocket/*!*/ self)
 {
     RubyArray result = new RubyArray(2);
     RubySocket s = new RubySocket(context, self.Socket.Accept());
     result.Add(s);
     SocketAddress addr = s.Socket.RemoteEndPoint.Serialize();
     result.Add(MutableString.CreateAscii(addr.ToString()));
     return result;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:9,代码来源:Socket.cs

示例12: destroyTables

            public static void destroyTables(RhoDatabase/*!*/ self, RubyArray arInclude, RubyArray arExclude)
            {
                Vector<String> vecIncludes = RhoRuby.makeVectorStringFromArray(arInclude);
                Vector<String> vecExcludes = RhoRuby.makeVectorStringFromArray(arExclude);

                self.m_db.rb_destroy_tables(vecIncludes, vecExcludes);

                //throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
                //TODO: threw ruby exception

            }
开发者ID:Chanic,项目名称:rhodes,代码行数:11,代码来源:RhoDatabase.cs

示例13: GetGroup

        public static RubyArray GetGroup(RubyContext/*!*/ context, MatchData/*!*/ self, [DefaultProtocol]int start, [DefaultProtocol]int length) {
            if (!IListOps.NormalizeRange(self.Groups.Count, ref start, ref length)) {
                return null;
            }

            RubyArray result = new RubyArray();
            for (int i = 0; i < length; i++) {
                result.Add(self.GetGroupValue(context, start + i));
            }

            return result;
        }
开发者ID:jcteague,项目名称:ironruby,代码行数:12,代码来源:MatchDataOps.cs

示例14: List

        public static RubyArray/*!*/ List([NotNull]ThreadGroup/*!*/ self) {
            ThreadOps.RubyThreadInfo[] threads = ThreadOps.RubyThreadInfo.Threads;
            RubyArray result = new RubyArray(threads.Length);
            foreach (ThreadOps.RubyThreadInfo threadInfo in threads) {
                Thread thread = threadInfo.Thread;
                if (thread != null && threadInfo.Group == self) {
                    result.Add(thread);
                }
            }

            return result;
        }
开发者ID:jschementi,项目名称:iron,代码行数:12,代码来源:ThreadGroup.cs

示例15: DefineFinalizer

        public static object DefineFinalizer(RespondToStorage/*!*/ respondTo, BinaryOpStorage/*!*/ call, RubyModule/*!*/ self, object obj, object finalizer)
        {
            if (!Protocols.RespondTo(respondTo, finalizer, "call")) {
                throw RubyExceptions.CreateArgumentError("finalizer should be callable (respond to :call)");
            }

            respondTo.Context.SetInstanceVariable(obj, FinalizerInvoker.InstanceVariableName, new FinalizerInvoker(call.GetCallSite("call"), finalizer));
            RubyArray result = new RubyArray(2);
            result.Add(0);
            result.Add(finalizer);
            return result;
        }
开发者ID:TerabyteX,项目名称:main,代码行数:12,代码来源:ObjectSpace.cs


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