diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -2912,20 +2912,22 @@ rb_str_times(VALUE str, VALUE times) /* * call-seq: - * string % object -> new_string + * self % object -> new_string * - * Returns the result of formatting +object+ into the format specification +self+ - * (see Kernel#sprintf for formatting details): + * Returns the result of formatting +object+ into the format specifications + * contained in +self+ + * (see {Format Specifications}[rdoc-ref:format_specifications.rdoc]): * - * "%05d" % 123 # => "00123" + * '%05d' % 123 # => "00123" * - * If +self+ contains multiple substitutions, +object+ must be - * an Array or Hash containing the values to be substituted: + * If +self+ contains multiple format specifications, + * +object+ must be an array or hash containing the objects to be formatted: * - * "%-5s: %016x" % [ "ID", self.object_id ] # => "ID : 00002b054ec93168" - * "foo = %{foo}" % {foo: 'bar'} # => "foo = bar" - * "foo = %{foo}, baz = %{baz}" % {foo: 'bar', baz: 'bat'} # => "foo = bar, baz = bat" + * '%-5s: %016x' % [ 'ID', self.object_id ] # => "ID : 00002b054ec93168" + * 'foo = %{foo}' % {foo: 'bar'} # => "foo = bar" + * 'foo = %{foo}, baz = %{baz}' % {foo: 'bar', baz: 'bat'} # => "foo = bar, baz = bat" * + * Related: see {Methods for Converting to New String}[rdoc-ref:String@Methods+for+Converting+to+New+String]. */ static VALUE |