End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Module#attr_writer
attr_writer(symbol, ...) → array
attr_writer(string, ...) → array
object.c
View on GitHub ↗
static VALUE
rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass)
{
int i;
VALUE names = rb_ary_new2(argc);
for (i=0; i<argc; i++) {
ID id = id_for_attr(klass, argv[i]);
rb_attr(klass, id, FALSE, TRUE, TRUE);
rb_ary_push(names, ID2SYM(rb_id_attrset(id)));
}
return names;
}
Creates an accessor method to allow assignment to the attribute symbol.id2name. String arguments are converted to symbols. Returns an array of defined method names as symbols.
Ruby version changes
-
3.0
-
Module#attr_accessor,Module#attr_reader,Module#attr_writerandModule#attrmethods now return an array of defined method names as symbols. [Feature #17314]
-