Exemplo n.º 1
0
 public object ruby_p(RBasic r, params object[] o)
 {
     foreach (object x in o)
     {
         System.Console.Out.Write(RString.AsString(ruby, ruby.Inspect(x)) + ruby.defaultRecSep);
     }
     // check defout and if file, then flush
     return(null);
 }
Exemplo n.º 2
0
        object require(RBasic r, params object[] args)
        {
            string s = RString.AsString(ruby, args[0]);

            return(Require(s));
        }
Exemplo n.º 3
0
        public RString Join(object sep)
        {
            if (ptr.Count <= 0)
            {
                return(new RString(ruby, String.Empty, false));
            }
            bool taint = IsTainted;

            if (sep is RBasic && ((RBasic)sep).IsTainted)
            {
                taint = true;
            }
            string ssep = String.Empty;

            if (sep != null)
            {
                if (sep is string || sep is RString)
                {
                    ssep = sep.ToString();
                }
                else
                {
                    ssep = RString.StringToRString(ruby, sep).ToString();
                }
            }
            string result = String.Empty;
            string tmp;

            for (int i = 0; i < ptr.Count; i++)
            {
                object o = ptr[i];
                if (o is RBasic && ((RBasic)o).IsTainted)
                {
                    taint = true;
                }

                if (o is string || o is RString)
                {
                    tmp = o.ToString();
                }
                else if (o is RArray)
                {
                    if (ruby.IsInspecting(o))
                    {
                        tmp = "[...]";
                    }
                    else
                    {
                        tmp = ruby.ProtectInspect(this,
                                                  new InspectMethod(inspect_join),
                                                  new object[2] {
                            o, sep
                        }).ToString();
                    }
                }
                else
                {
                    tmp = RString.AsString(ruby, o);
                }
                if (i > 0)
                {
                    result += ssep;
                }
                result += tmp;
            }
            return(new RString(ruby, result, taint));
        }