[Ruby] refactoring/drying help

shane becker veganstraightedge at gmail.com
Thu Oct 11 15:52:10 PDT 2007


> You probably want to initialize that array outside the loop for
> starters... then just pull the common bits out of the if  blocks:
>
> people =[]

right that makes sense.

>   if artist.writer then
>     person.role_id = 1
>   elsif artist.artist then
>     person.role_id = 2
>   end

this is the area that caused me problems. b/c it's possible to have  
multiple roles.

dean hudson writer
dean hudson artist


More information about the Ruby mailing list