[前][次][番号順一覧][スレッド一覧]

ruby-changes:49973

From: mame <ko1@a...>
Date: Mon, 29 Jan 2018 17:40:28 +0900 (JST)
Subject: [ruby-changes:49973] mame:r62091 (trunk): string.c (rb_str_format_m): Fix the example code of the doc

mame	2018-01-29 17:40:22 +0900 (Mon, 29 Jan 2018)

  New Revision: 62091

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62091

  Log:
    string.c (rb_str_format_m): Fix the example code of the doc
    
    Change `%08x` to `%016x` because of two reasons:
    
    * `%016x` demonstrates that we can use two or more digits here.
    * Currently, many people uses 64-bit environment.
      (I'm unsure if object_id is a good example here, though...)
    I'm unsure if

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 62090)
+++ string.c	(revision 62091)
@@ -1988,7 +1988,7 @@ rb_str_times(VALUE str, VALUE times) https://github.com/ruby/ruby/blob/trunk/string.c#L1988
  *  details of the format string.
  *
  *     "%05d" % 123                              #=> "00123"
- *     "%-5s: %08x" % [ "ID", self.object_id ]   #=> "ID   : 200e14d6"
+ *     "%-5s: %016x" % [ "ID", self.object_id ]  #=> "ID   : 00002b054ec93168"
  *     "foo = %{foo}" % { :foo => 'bar' }        #=> "foo = bar"
  */
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]