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


C# RubyContext.Inspect方法代码示例

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


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

示例1: ToString

                public static MutableString ToString(RubyContext/*!*/ context, Certificate/*!*/ self) {
                    using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                        // #<OpenSSL::X509::Certificate subject=, issuer=, serial=0, not_before=nil, not_after=nil>
                        var result = MutableString.CreateEmpty();
                        result.Append("#<");
                        result.Append(context.Inspect(context.GetClassOf(self)));

                        if (handle == null) {
                            return result.Append(":...>");
                        }
                        bool empty = self._certificate.Handle == IntPtr.Zero;
                        result.AppendFormat(" subject={0}, issuer={1}, serial={2}, not_before=nil, not_after=nil>", 
                            empty ? "" : OpenSSLFormat(self._certificate.Subject),
                            empty ? "" : OpenSSLFormat(self._certificate.Issuer),
                            empty ? 0 : self.SerailNumber
                        );
                        return result;
                    }
                }
开发者ID:jschementi,项目名称:iron,代码行数:19,代码来源:OpenSSL.cs

示例2: FormatMethodMissingMessage

        internal static string/*!*/ FormatMethodMissingMessage(RubyContext/*!*/ context, object obj, string/*!*/ name, string/*!*/ message) {
            Assert.NotNull(name);

            string str;
            if (obj == null) {
                str = "nil:NilClass";
            } else if (_disableMethodMissingMessageFormatting) {
                str = RubyUtils.ObjectToMutableString(context, obj).ToString();
            } else {
                _disableMethodMissingMessageFormatting = true;
                try {
                    str = context.Inspect(obj).ConvertToString();
                    if (!str.StartsWith("#", StringComparison.Ordinal)) {
                        str += ":" + context.GetClassName(obj);
                    }
                } catch (Exception) {
                    // MRI: swallows all exceptions
                    str = RubyUtils.ObjectToMutableString(context, obj).ToString();
                } finally {
                    _disableMethodMissingMessageFormatting = false;
                }
            }
            
            return FormatMessage(message, name, str);
        }
开发者ID:cleydson,项目名称:ironruby,代码行数:25,代码来源:RubyExceptions.cs

示例3: Inspect

 public static MutableString Inspect(RubyContext/*!*/ context, YamlStream/*!*/ self)
 {
     MutableString result = MutableString.CreateMutable("#<YAML::Stream:", RubyEncoding.Binary);
     RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(context, self))
     .Append(" @documents=")
     .Append(context.Inspect(self._documents))
     .Append(", options=")
     .Append(context.Inspect(self._options))
     .Append('>');
     return result;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:11,代码来源:YamlStream.cs

示例4: Inspect

        public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, IList/*!*/ self) {

            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                if (handle == null) {
                    return MutableString.Create("[...]");
                }
                MutableString str = MutableString.CreateMutable();
                str.Append('[');
                bool first = true;
                foreach (object obj in self) {
                    if (first) {
                        first = false;
                    } else {
                        str.Append(", ");
                    }
                    str.Append(context.Inspect(obj));
                }
                str.Append(']');
                return str;
            }
        }
开发者ID:aceptra,项目名称:ironruby,代码行数:21,代码来源:IListOps.cs

示例5: InvalidValueForType

 public static Exception/*!*/ InvalidValueForType(RubyContext/*!*/ context, object obj, string type) {
     return CreateArgumentError("invalid value for {0}: {1}", type, context.Inspect(obj));
 }
开发者ID:cleydson,项目名称:ironruby,代码行数:3,代码来源:RubyExceptions.cs

示例6: Inspect

 public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, FileSystemInfo/*!*/ self) {
    return MutableString.CreateAscii(String.Format(CultureInfo.InvariantCulture, 
         "#<File::Stat dev={0}, ino={1}, mode={2}, nlink={3}, uid={4}, gid={5}, rdev={6}, size={7}, blksize={8}, blocks={9}, atime={10}, mtime={11}, ctime={12}",
         context.Inspect(DeviceId(self)),
         context.Inspect(Inode(self)),
         context.Inspect(Mode(self)),
         context.Inspect(NumberOfLinks(self)),
         context.Inspect(UserId(self)),
         context.Inspect(GroupId(self)),
         context.Inspect(DeviceId(self)),
         context.Inspect(Size(self)),
         context.Inspect(BlockSize(self)),
         context.Inspect(Blocks(self)),
         context.Inspect(AccessTime(self)),
         context.Inspect(ModifiedTime(self)),
         context.Inspect(CreateTime(self))
     ));
 }
开发者ID:rpattabi,项目名称:ironruby,代码行数:18,代码来源:FileOps.cs

示例7: Inspect

 /*!*/
 public MutableString Inspect(RubyContext/*!*/ context)
 {
     var result = MutableString.CreateMutable(RubyEncoding.Binary);
     result.Append(context.Inspect(_begin));
     result.Append(Separator);
     result.Append(context.Inspect(_end));
     return result;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:9,代码来源:Range.cs

示例8: ToString

        public static MutableString ToString(RubyContext/*!*/ context, Certificate/*!*/ self) {
          using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
            // #<OpenSSL::X509::Certificate subject=, issuer=, serial=0, not_before=nil, not_after=nil>
            var result = MutableString.CreateEmpty();
            result.Append("#<");
            result.Append(context.Inspect(context.GetClassOf(self)));

            if (handle == null) {
              return result.Append(":...>");
            }
            result.Append(' ');
            if (self._certificate.Handle == IntPtr.Zero) {
              result.Append("subject=, issuer=, serial=0, not_before=nil, not_after=nil");
            } else {
              result.Append(string.Format("subject={0}", OpenSSLFormat(self._certificate.Subject)));
              result.Append(string.Format(", issuer={0}", OpenSSLFormat(self._certificate.Issuer)));
              result.Append(string.Format(", serial={0}", self.SerailNumber));
              result.Append(string.Concat(", not_before=", "nil"));
              result.Append(string.Concat(", not_after=", "nil"));
            }
            result.Append('>');
            return result;
          }
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:24,代码来源:OpenSSL.cs

示例9: Inspect

        public static MutableString/*!*/ Inspect(UnaryOpStorage/*!*/ inspectStorage, ConversionStorage<MutableString>/*!*/ tosStorage, 
            RubyContext/*!*/ context, Range/*!*/ self) {

            var result = MutableString.CreateMutable();
            result.Append(context.Inspect(self.Begin));
            result.Append(self.ExcludeEnd ? "..." : "..");
            result.Append(context.Inspect(self.End));
            return result;
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:9,代码来源:RangeOps.cs

示例10: Throw

        public static void Throw(RubyContext/*!*/ context, object self, object label, [DefaultParameterValue(null)]object returnValue) {
            if (_catchSymbols == null || !_catchSymbols.Contains(label, ReferenceEqualityComparer.Instance)) {
                throw RubyExceptions.CreateNameError("uncaught throw `{0}'", context.Inspect(label).ToAsciiString(false));
            }

            throw new ThrowCatchUnwinder(label, returnValue);
        }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例11: Inspect

        public static MutableString/*!*/ Inspect(RubyContext/*!*/ context, Hash/*!*/ self) {

            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                if (handle == null) {
                    return MutableString.CreateAscii("{...}");
                }

                MutableString str = MutableString.CreateMutable(RubyEncoding.Binary);
                str.Append('{');
                bool first = true;
                foreach (var entry in self) {
                    if (first) {
                        first = false;
                    } else {
                        str.Append(", ");
                    }
                    str.Append(context.Inspect(CustomStringDictionary.ObjToNull(entry.Key)));
                    str.Append("=>");
                    str.Append(context.Inspect(entry.Value));
                }
                str.Append('}');
                return str;
            }
        }
开发者ID:madpilot,项目名称:ironruby,代码行数:24,代码来源:HashOps.cs

示例12: Inspect

        public static MutableString Inspect(RubyContext/*!*/ context, IList/*!*/ self)
        {
            using (IDisposable handle = RubyUtils.InfiniteInspectTracker.TrackObject(self)) {
                if (handle == null) {
                    return MutableString.CreateAscii("[...]");
                }
                MutableString str = MutableString.CreateMutable(RubyEncoding.Binary);
                if (self.Count > 0) { // tainted empty arrays don't taint the inspect string if the array is empty
                    str.TaintBy(self, context);
                }

                str.Append('[');
                bool first = true;
                foreach (object obj in self) {
                    if (first) {
                        first = false;
                    } else {
                        str.Append(", ");
                    }

                    var objInspected = context.Inspect(obj);
                    str.Append(objInspected);
                    str.TaintBy(objInspected);
                }
                str.Append(']');
                return str;
            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:28,代码来源:IListOps.cs


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