mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_mod_attr_accessor, rb_mod_const_set): made rdoc
more precise by specifying Object can searched for Modules. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c5719d9a75
commit
ffd86054f5
1 changed files with 13 additions and 8 deletions
21
object.c
21
object.c
|
@ -1701,12 +1701,14 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
|
|||
* call-seq:
|
||||
* mod.const_get(sym, inherit=true) -> obj
|
||||
*
|
||||
* Returns the value of the named constant in <i>mod</i>.
|
||||
* 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+.)
|
||||
*
|
||||
* The value of the constant is returned if a definition is found,
|
||||
* otherwise a +NameError+ is raised.
|
||||
*
|
||||
* Math.const_get(:PI) #=> 3.14159265358979
|
||||
*
|
||||
* If the constant is not defined or is defined by the ancestors and
|
||||
* +inherit+ is false, +NameError+ will be raised.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
@ -1757,12 +1759,15 @@ rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
|
|||
* call-seq:
|
||||
* mod.const_defined?(sym, inherit=true) -> true or false
|
||||
*
|
||||
* Returns <code>true</code> if a constant with the given name is
|
||||
* defined by <i>mod</i>, or its ancestors if +inherit+ is not 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
|
||||
* IO.const_defined? :SYNC #=> true
|
||||
* IO.const_defined? :SYNC, false #=> false
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Reference in a new issue