Unfortunately, there's no way to know if a string is a literal or not,
short of parsing the Ruby, and considering the sheer number of string
literals in Ruby, that seems very infeasible.

/Jonas

P.S.: off the top of my head:

"word"
'word'
%(word)
%[word]
%{word}
%q(word)
%q[word]
%q{word}
%Q(word)
%Q[word]
%Q{word}
<<STRING
word
STRING
<<-STRING
  word
STRING
etc...

On Sun, Apr 4, 2010 at 1:51 PM, [email protected]
<[email protected]> wrote:
> Hi,
>
> Using Rails 3 (git master) and Ruby 1.9.2-head I noticed I have to
> treat EVERY SINGLE STRING in my app, even things like
>
>  link_to "&nbsp;bla", path
>
> with raw(). This is crazy! It is a FIXED string! I understand it when
> variables are concerned, but this is taking it a little too far. One
> might even say the escaping only is necessary if STRING variables are
> introduced, so including number-variables in a(n otherwise fixed)
> string should not trigger the need to use raw().
>
> I only just started but the amount of "raw()" I have to insert into my
> app seems excessive.
>
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" 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-core?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en.

Reply via email to