Method: Altprintf.fmtm

Defined in:
ext/altprintf/ext.c

.fmtm(passes, format_string[, arguments...]) ⇒ String

Same as #fmt, but takes an additional argument, passes, which specifies the number of passes to go over the format string.

For example: fmtm(0, “%%%%%%%%”) #=> “%%%%%%%%” fmtm(1, “%%%%%%%%”) #=> “%%%%” fmtm(2, “%%%%%%%%”) #=> “%%” fmtm(3, “%%%%%%%%”) #=> “%” fmtm(4, “%%%%%%%%”) #=> “”

Returns:

  • (String)


253
254
255
256
257
258
259
260
261
262
263
264
# File 'ext/altprintf/ext.c', line 253

VALUE rb_altprintf_multi_pass(size_t argc, VALUE *argv, VALUE self)
{
  long passes;

  Check_Type(argv[0], T_FIXNUM);
  passes = FIX2LONG(argv[0]);
  if (passes < 0)
    rb_raise(rb_eArgError, "expected positive number of passes");

  LOG("passes: %ld\n", passes);
  return rb_altprintf(passes, argc - 1, &argv[1], self);
}