public Method

Module.const_defined?(p1)

mod.const_defined?(sym)    true or false

Returns true if a constant with the given name is defined by mod.

Math.const_defined? "PI"   #=> true

Source Code

/*
*  call-seq:
*     mod.const_defined?(sym)   => true or false
*  
*  Returns <code>true</code> if a constant with the given name is
*  defined by <i>mod</i>.
*     
*     Math.const_defined? "PI"   #=> true
*/

static VALUE
rb_mod_const_defined(mod, name)
   VALUE mod, name;
{
   ID id = rb_to_id(name);

   if (!rb_is_const_id(id)) {
       rb_name_error(id, "wrong constant name %s", rb_id2name(id));
   }
   return rb_const_defined_at(mod, id);
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.