예제 #1
0
        private static string /*!*/ FormatMethodMissingMessage(RubyContext /*!*/ context, object self, string /*!*/ name, string /*!*/ message)
        {
            Assert.NotNull(name);
            string strObject;

            if (self == null)
            {
                strObject = "nil:NilClass";
            }
            else
            {
                strObject = RubySites.ToS(context, self).ConvertToString();
                if (!strObject.StartsWith("#"))
                {
                    strObject += ":" + RubyUtils.GetClassName(context, self);
                }
            }

            return(String.Format(message, name, strObject));
        }
예제 #2
0
        public static Node /*!*/ ToYaml(double self, [NotNull] RubyRepresenter /*!*/ rep)
        {
            MutableString str = RubySites.ToS(rep.Context, self);

            if (str != null)
            {
                if (str.Equals("Infinity"))
                {
                    str = MutableString.Create(".Inf");
                }
                else if (str.Equals("-Infinity"))
                {
                    str = MutableString.Create("-.Inf");
                }
                else if (str.Equals("NaN"))
                {
                    str = MutableString.Create(".NaN");
                }
            }
            return(rep.Scalar(self, str));
        }
예제 #3
0
 public static Node ToYaml(object self, [NotNull] RubyRepresenter /*!*/ rep)
 {
     return(rep.Scalar(self, RubySites.ToS(rep.Context, self)));
 }