Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Module#attr

attr(name, ...) → array
attr(name, true) → array
attr(name, false) → array

The first form is equivalent to attr_reader. The second form is equivalent to attr_accessor(name) but deprecated. The last form is equivalent to attr_reader(name) but deprecated. Returns an array of defined method names as symbols.

Ruby version changes

  1. 3.0