From c2a3a47f40c5884a2f867ae90b1d2fb8172e3925 Mon Sep 17 00:00:00 2001 From: yugui Date: Mon, 15 Nov 2010 11:44:05 +0000 Subject: [PATCH] merges r29254 from trunk into ruby_1_9_2. -- * string.c (rb_str_times): mentioned about Hash argument. a patch from Daniel Bovensiepen at [ruby-core:32386]. * sprintf.c (get_hash): ditto, and fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ sprintf.c | 6 +++--- string.c | 7 ++++--- version.h | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2af9c9ef4f..a8e39d0743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Sep 15 07:27:52 2010 Nobuyoshi Nakada + + * string.c (rb_str_times): mentioned about Hash argument. a patch + from Daniel Bovensiepen at [ruby-core:32386]. + + * sprintf.c (get_hash): ditto, and fix typo. + Mon Sep 13 19:56:50 2010 Nobuyoshi Nakada * ext/socket/rubysocket.h (__DARWIN_ALIGNBYTES): workaround of a diff --git a/sprintf.c b/sprintf.c index bf0d3d6fcf..319e68a956 100644 --- a/sprintf.c +++ b/sprintf.c @@ -422,13 +422,13 @@ get_hash(volatile VALUE *hash, int argc, const VALUE *argv) * 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 diff --git a/string.c b/string.c index cd0103f8d5..c85d249760 100644 --- a/string.c +++ b/string.c @@ -1224,12 +1224,13 @@ 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" + * "foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar" */ static VALUE diff --git a/version.h b/version.h index dd790f0fdf..9f8264b07c 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 41 +#define RUBY_PATCHLEVEL 42 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1