#6 new

Make attr_* accept a block and add initiate arguments

Reported by elliottcable | April 9th, 2008 @ 01:20 AM | in Stable API for System devs

Allow attr_accessor and siblings to optionally take a false block as follows, or something similar:

attr_accessor :involved {|arg1, arg2|}

... then dynamically unshift arg1 and arg2 onto the arguments passable to #new.

Should set default values, overriding those passed in the normal arguments hash, as one would normally do so:

attr_accessor :involved do |arg1, arg2|
  arg1 = #some code to generate arg1's default value
  arg2 = #some code to generate arg2's default value

Sorry if this is stupid, it's 1:30 AM and I may not be lucid. Yay hacks!

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket