Help with a customization problem
I think that's the best way to put it. ;)
I have a string I'm outputting that is built with this line:
So I have an AR object called box_score with attributes that I'm outputting. The output could look like this (with additional calls to the above etc):
This output is actually being generated to look exactly like the above with code box and all and is for posting on vBulletin like forums like this. What I'd like to do is allow my users to customize the appearance of this output by applying bbCode to any and all pieces of this output.
1st 2nd 3rd 4th Final
Montana 7 7 14 7 35
Michigan 0 0 7 7 14
This certainly has many, many solutions. I'm having some problems coming up with any good ones. Some considerations:
1) The customization will be saved and applied to all future output. Basically the user should be able to create this customized look and it will be used again in other games outputs (this example is for American football box scores so there are other games outputs that will be generated).
2) Following from above this customization should be able to be applied to any and all future box score outputs as a template.
3) The solution should be flexible enough to allow it to be used to allow users to customize other types of output like collections (that will be loops for outputting).
My current thought is to have the user create a psuedo code string with placeholders for the AR objects attributes and somehow applying this to the above code example. Not sure how to go about this best though. Also not sure this is the best way to do it. I feel like I'm missing some Ruby magic that would allow me to do this better. Maybe using some sort of decorator pattern for the AR object to alter it's output? The dynamic nature of AR objects though makes this tricky for me and I'm not sure how to proceed. Any and all suggestions and help are greatly appreciated. Thanks. :)