/* * call-seq: * str % arg => new_str * * Format---Uses <i>str</i> as a format specification, and returns the result * of applying it to <i>arg</i>. If the format specification contains more than * one substitution, then <i>arg</i> must be an <code>Array</code> containing * the values to be substituted. See <code>Kernel::sprintf</code> for details * of the format string. * * "%05d" % 123 #=> "00123" * "%-5s: %08x" % [ "ID", self.id ] #=> "ID : 200e14d6" */ static VALUE rb_str_format_m(str, arg) VALUE str, arg; { volatile VALUE tmp = rb_check_array_type(arg); if (!NIL_P(tmp)) { return rb_str_format(RARRAY_LEN(tmp), RARRAY_PTR(tmp), str); } return rb_str_format(1, &arg, str); }