I'm somewhat surprised that the template class doesnt have that
function, but Prototype already has a function called
String.extractScripts(). If you know regular expressions then it
should be easy to write a String.extractTemplateSymbols() function by
replacing ScriptFragment with your own SymbolFragment.
I'm a little rusty on my regular expressions, but here's my crack at
it:
SymbolFragment = "(?:#{)(\w+)(?:})"
Hope that helps,
RR
On Jun 13, 3:41 pm, Les <[EMAIL PROTECTED]> wrote:
> How can I retrieve a list of symbols from any template string?
>
> See the example below. I'd like to be able to retrieve ['title',
> 'author'] from that template.
>
> 'The TV show #{title} was created by #{author}.'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---