Project

General

Profile

Feature #8564

Extend Module#attr... methods

Added by Anonymous over 7 years ago. Updated about 6 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:55623]

Description

Extend #attr_reader, #attr_writer, #attr_accessor syntax to accept default values, such as:

attr_reader foo: 42, bar: 43

Possibility of closures evaluated at initialization time might also be considered:

attr_reader baz: -> { Time.now }, quux: 42

Also available in: Atom PDF