Method: Module#attr_reader
- Defined in:
- object.c
#attr_reader(symbol, ...) ⇒ nil (private) #attr(symbol, ...) ⇒ nil (private) #attr_reader(string, ...) ⇒ nil (private) #attr(string, ...) ⇒ nil (private)
Creates instance variables and corresponding methods that return the value of each instance variable. Equivalent to calling “attr:name” on each name in turn. String arguments are converted to symbols.
1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 |
# File 'object.c', line 1979
static VALUE
rb_mod_attr_reader(int argc, VALUE *argv, VALUE klass)
{
int i;
for (i=0; i<argc; i++) {
rb_attr(klass, id_for_attr(argv[i]), TRUE, FALSE, TRUE);
}
return Qnil;
}
|