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

ruby-changes:37367

From: usa <ko1@a...>
Date: Fri, 30 Jan 2015 16:51:42 +0900 (JST)
Subject: [ruby-changes:37367] usa:r49448 (ruby_2_0_0): merge revision(s) 45375, 48260, 48320, 48746: [Backport #10526]

usa	2015-01-30 16:51:23 +0900 (Fri, 30 Jan 2015)

  New Revision: 49448

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

  Log:
    merge revision(s) 45375,48260,48320,48746: [Backport #10526]
    
    * complax.c: [DOC] Document number conversion of `nil` by @skade [fix GH-570] [ci skip]
    
    * object.c, rational.c: ditto.
    * object.c: fix document of Kernel.Stirng by @suzukaze
      [fix GH-743][ci skip]
    
    * object.c (Module#const_defined?): [DOC] Revise the documentation.
      Patch by Xavier Noria.
      [Fixes GH-754] https://github.com/ruby/ruby/pull/754
    
    * object.c: [DOC] Revise documentation by Marcus Stollsteimer at
      [ruby-core:66368].  [Bug #10526]
      * #inspect: be more specific about generated string, remove
        obsolete example.
      * #nil?: use code examples instead of different call-seq's.
      * #tap: clarify what is yielded.
      * Integer(): be more specific about to_int and to_i, remove
        reference to Ruby 1.8.
      * Array(): fix error.
      * Class: fix variable name style and indentation in example.
      * improve consistency, fix typos and formatting.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/complex.c
    branches/ruby_2_0_0/object.c
    branches/ruby_2_0_0/rational.c
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/complex.c
===================================================================
--- ruby_2_0_0/complex.c	(revision 49447)
+++ ruby_2_0_0/complex.c	(revision 49448)
@@ -483,6 +483,8 @@ f_complex_new2(VALUE klass, VALUE x, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/complex.c#L483
  *
  *    Complex(1, 2)    #=> (1+2i)
  *    Complex('1+2i')  #=> (1+2i)
+ *    Complex(nil)     #=> TypeError
+ *    Complex(1, nil)  #=> TypeError
  *
  * Syntax of string form:
  *
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 49447)
+++ ruby_2_0_0/ChangeLog	(revision 49448)
@@ -1,3 +1,29 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Jan 30 16:49:15 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* object.c: [DOC] Revise documentation by Marcus Stollsteimer at
+	  [ruby-core:66368].  [Bug #10526]
+
+	  * #inspect: be more specific about generated string, remove
+	    obsolete example.
+	  * #nil?: use code examples instead of different call-seq's.
+	  * #tap: clarify what is yielded.
+	  * Integer(): be more specific about to_int and to_i, remove
+	    reference to Ruby 1.8.
+	  * Array(): fix error.
+	  * Class: fix variable name style and indentation in example.
+	  * improve consistency, fix typos and formatting.
+
+Fri Jan 30 16:49:15 2015  Benoit Daloze  <eregontp@g...>
+
+	* object.c (Module#const_defined?): [DOC] Revise the documentation.
+	  Patch by Xavier Noria.
+	  [Fixes GH-754] https://github.com/ruby/ruby/pull/754
+
+Fri Jan 30 16:49:15 2015  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* object.c: fix document of Kernel.Stirng by @suzukaze
+	  [fix GH-743][ci skip]
+
 Fri Jan 30 16:26:57 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* pack.c (str_associate, str_associated): keep associated objects
Index: ruby_2_0_0/object.c
===================================================================
--- ruby_2_0_0/object.c	(revision 49447)
+++ ruby_2_0_0/object.c	(revision 49448)
@@ -2081,15 +2081,40 @@ rb_mod_const_set(VALUE mod, VALUE name, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L2081
  *  call-seq:
  *     mod.const_defined?(sym, inherit=true)   -> true or false
  *
- *  Checks for a constant with the given name in <i>mod</i>
- *  If +inherit+ is set, the lookup will also search
- *  the ancestors (and +Object+ if <i>mod</i> is a +Module+.)
- *
- *  Returns whether or not a definition is found:
- *
- *     Math.const_defined? "PI"   #=> true
- *     IO.const_defined? :SYNC   #=> true
- *     IO.const_defined? :SYNC, false   #=> false
+ *  Says whether _mod_ or its ancestors have a constant with the given name:
+ *
+ *    Float.const_defined?(:EPSILON)      #=> true, found in Float itself
+ *    Float.const_defined?("String")      #=> true, found in Object (ancestor)
+ *    BasicObject.const_defined?(:Hash)   #=> false
+ *
+ *  If _mod_ is a +Module+, additionally +Object+ and its ancestors are checked:
+ *
+ *    Math.const_defined?(:String)   #=> true, found in Object
+ *
+ *  In each of the checked classes or modules, if the constant is not present
+ *  but there is an autoload for it, +true+ is returned directly without
+ *  autoloading:
+ *
+ *    module Admin
+ *      autoload :User, 'admin/user'
+ *    end
+ *    Admin.const_defined?(:User)   #=> true
+ *
+ *  If the constant is not found the callback +const_missing+ is *not* called
+ *  and the method returns +false+.
+ *
+ *  If +inherit+ is false, the lookup only checks the constants in the receiver:
+ *
+ *    IO.const_defined?(:SYNC)          #=> true, found in File::Constants (ancestor)
+ *    IO.const_defined?(:SYNC, false)   #=> false, not found in IO itself
+ *
+ *  In this case, the same logic for autoloading applies.
+ *
+ *  If the argument is not a valid constant name +NameError+ is raised with the
+ *  message "wrong constant name _name_":
+ *
+ *    Hash.const_defined? 'foobar'   #=> NameError: wrong constant name foobar
+ *
  */
 
 static VALUE
@@ -2529,13 +2554,15 @@ rb_Integer(VALUE val) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L2554
  *  In any case, strings should be strictly conformed to numeric
  *  representation. This behavior is different from that of
  *  <code>String#to_i</code>.  Non string values will be converted using
- *  <code>to_int</code>, and <code>to_i</code>.
+ *  <code>to_int</code>, and <code>to_i</code>. Passing <code>nil</code>
+ *  raises a TypeError.
  *
  *     Integer(123.999)    #=> 123
  *     Integer("0x1a")     #=> 26
  *     Integer(Time.new)   #=> 1204973019
  *     Integer("0930", 10) #=> 930
  *     Integer("111", 2)   #=> 7
+ *     Integer(nil)        #=> TypeError
  */
 
 static VALUE
@@ -2774,8 +2801,9 @@ rb_String(VALUE val) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/object.c#L2801
  *  call-seq:
  *     String(arg)   -> string
  *
- *  Converts <i>arg</i> to a <code>String</code> by calling its
- *  <code>to_s</code> method.
+ *  Returns <i>arg</i> as an <code>String</code>.
+ *
+ *  First tries to call its <code>to_str</code> method, then its <code>to_s</code> method.
  *
  *     String(self)        #=> "main"
  *     String(self.class)  #=> "Object"
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 49447)
+++ ruby_2_0_0/version.h	(revision 49448)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2015-01-30"
-#define RUBY_PATCHLEVEL 628
+#define RUBY_PATCHLEVEL 629
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_0_0/rational.c
===================================================================
--- ruby_2_0_0/rational.c	(revision 49447)
+++ ruby_2_0_0/rational.c	(revision 49448)
@@ -571,6 +571,8 @@ f_rational_new_no_reduce2(VALUE klass, V https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/rational.c#L571
  *
  *    Rational(1, 2)   #=> (1/2)
  *    Rational('1/2')  #=> (1/2)
+ *    Rational(nil)    #=> TypeError
+ *    Rational(1, nil) #=> TypeError
  *
  * Syntax of string form:
  *

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45375,48260,48320


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

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