コード例 #1
0
 public static MutableString/*!*/ Format(RubyContext/*!*/ context, MutableString/*!*/ self, object arg) {
     IList args = arg as IList;
     if (args == null) {
         args = new object[] { arg };
     }
     StringFormatter formatter = new StringFormatter(context, self.ConvertToString(), args);
     return formatter.Format().TaintBy(self);
 }
コード例 #2
0
ファイル: ClrStringOps.cs プロジェクト: atczyc/ironruby
 public static string/*!*/ Format(StringFormatterSiteStorage/*!*/ storage, string/*!*/ self, [NotNull]IList/*!*/ args) {
     StringFormatter formatter = new StringFormatter(storage, self, RubyEncoding.UTF8, args);
     return formatter.Format().ToString();
 }
コード例 #3
0
ファイル: Marshal.cs プロジェクト: rafacv/iron_languages
 private void WriteFloat(double value) {
     // TODO: Ruby appears to have an optimization that saves the (binary) mantissa at the end of the string
     _writer.Write((byte)'f');
     if (Double.IsInfinity(value)) {
         if (Double.IsPositiveInfinity(value)) {
             WriteStringValue(_positiveInfinityString);
         } else {
             WriteStringValue(_negativeInfinityString);
         }
     } else if (Double.IsNaN(value)) {
         WriteStringValue(_nanString);
     } else {
         StringFormatter sf = new StringFormatter(_context, "%.15g", RubyEncoding.Binary, new object[] { value });
         sf.TrailingZeroAfterWholeFloat = false;
         WriteStringValue(sf.Format());
     }
 }
コード例 #4
0
 public static MutableString/*!*/ Format(StringFormatterSiteStorage/*!*/ storage, MutableString/*!*/ self, object arg) {
     IList args = arg as IList ?? new object[] { arg };
     StringFormatter formatter = new StringFormatter(storage, self.ConvertToString(), self.Encoding, args);
     return formatter.Format().TaintBy(self);
 }
コード例 #5
0
ファイル: FloatOps.cs プロジェクト: mscottford/ironruby
 public static MutableString ToS(RubyContext/*!*/ context, double self) {
     StringFormatter sf = new StringFormatter(context, "%.15g", new object[] { self });
     sf.TrailingZeroAfterWholeFloat = true;
     return sf.Format();
 }
コード例 #6
0
ファイル: MutableStringOps.cs プロジェクト: tnachen/ironruby
        public static MutableString/*!*/ Format(
            ConversionStorage<IntegerValue>/*!*/ integerCast,
            ConversionStorage<int>/*!*/ fixnumCast,
            ConversionStorage<double>/*!*/ tofConversion, 
            ConversionStorage<MutableString>/*!*/ tosConversion,
            UnaryOpStorage/*!*/ inspectStorage,
            RubyContext/*!*/ context, MutableString/*!*/ self, object arg) {

            IList args = arg as IList ?? new object[] { arg };

            StringFormatter formatter = new StringFormatter(integerCast, fixnumCast, tofConversion, tosConversion, inspectStorage, context, 
                self.ConvertToString(), args
            );

            return formatter.Format().TaintBy(self);
        }
コード例 #7
0
 public static MutableString/*!*/ Format(StringFormatterSiteStorage/*!*/ storage, MutableString/*!*/ self, [NotNull]IList/*!*/ args) {
     StringFormatter formatter = new StringFormatter(storage, self.ConvertToString(), self.Encoding, args);
     return formatter.Format().TaintBy(self);
 }
コード例 #8
0
ファイル: ClrStringOps.cs プロジェクト: jcteague/ironruby
 public static string/*!*/ Format(StringFormatterSiteStorage/*!*/ storage, string/*!*/ self, object arg) {
     IList args = arg as IList ?? new object[] { arg };
     StringFormatter formatter = new StringFormatter(storage, self, args);
     return formatter.Format().ToString();
 }
コード例 #9
0
ファイル: ClrStringOps.cs プロジェクト: rudimk/dlr-dotnet
        public static string /*!*/ Format(StringFormatterSiteStorage /*!*/ storage, string /*!*/ self, [NotNull] IList /*!*/ args)
        {
            StringFormatter formatter = new StringFormatter(storage, self, RubyEncoding.UTF8, args);

            return(formatter.Format().ToString());
        }