Index: string.c
===================================================================
--- string.c (revision 29250)
+++ string.c (working copy)
@@ -1224,14 +1224,14 @@ rb_str_times(VALUE str, VALUE times)
*
* Format---Uses str as a format specification, and returns the result
* of applying it to arg. If the format specification contains more than
- * one substitution, then arg must be an Array
containing
- * the values to be substituted. See Kernel::sprintf
for details
- * of the format string.
+ * one substitution, then arg must be an Array
or Hash
+ * containing the values to be substituted. See Kernel::sprintf
for
+ * details of the format string.
*
- * "%05d" % 123 #=> "00123"
- * "%-5s: %08x" % [ "ID", self.object_id ] #=> "ID : 200e14d6"
+ * "%05d" % 123 #=> "00123"
+ * "%-5s: %08x" % [ "ID", self.object_id ] #=> "ID : 200e14d6"
+ * "foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar"
*/
-
static VALUE
rb_str_format_m(VALUE str, VALUE arg)
{
Index: sprintf.c
===================================================================
--- sprintf.c (revision 29250)
+++ sprintf.c (working copy)
@@ -422,13 +422,13 @@ get_hash(volatile VALUE *hash, int argc, const VAL
* sprintf("%u", -123) #=> "-123"
*
* For more complex formatting, Ruby supports a reference by name.
- * %s style uses format style, but ${name} style doesn't.
+ * %s style uses format style, but %{name} style doesn't.
*
* Exapmles:
* sprintf("%d : %f" % { :foo => 1, :bar => 2 })
* #=> 1 : 2.000000
- * sprintf("%d %{foo}" % { :foo => 'bar' })
- * # => "%d bar"
+ * sprintf("%{foo}f" % { :foo => 1 })
+ * # => "1f"
*/
VALUE