public Method

Module.attr_reader(...)

attr_reader(symbol, ...)     nil

Creates instance variables and corresponding methods that return the value of each instance variable. Equivalent to calling ``attr:name’’ on each name in turn.

Source Code

/*
*  call-seq:
*     attr_reader(symbol, ...)    => nil
*  
*  Creates instance variables and corresponding methods that return the
*  value of each instance variable. Equivalent to calling
*  ``<code>attr</code><i>:name</i>'' on each name in turn.
*/

static VALUE
rb_mod_attr_reader(argc, argv, klass)
   int argc;
   VALUE *argv;
   VALUE klass;
{
   int i;

   for (i=0; i<argc; i++) {
       rb_attr(klass, rb_to_id(argv[i]), 1, 0, Qtrue);
   }
   return Qnil;
}
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.