public Method

Module.attr_accessor(...)

attr_accessor(symbol, ...)     nil

Equivalent to calling ``attrsymbol, true’’ on each symbol in turn.

module Mod
  attr_accessor(:one, :two)
end
Mod.instance_methods.sort   #=> ["one", "one=", "two", "two="]

Source Code

/*
*  call-seq:
*     attr_accessor(symbol, ...)    => nil
*  
*  Equivalent to calling ``<code>attr</code><i>symbol</i><code>,
*  true</code>'' on each <i>symbol</i> in turn.
*     
*     module Mod
*       attr_accessor(:one, :two)
*     end
*     Mod.instance_methods.sort   #=> ["one", "one=", "two", "two="]
*/

static VALUE
rb_mod_attr_accessor(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, 1, 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.