S
Samuel Williams
Hi,
I'm curious if anyone has considered a method called interpolate:
class String
def interpolate(binding, filename, lineno)
... magic ...
end
end
It would have a similar effect as %Q, but the input would already exist =
as a string rather than being parsed. This would avoid lots of escaping =
issues. i.e.
eval("%Q{" + buffer + "}") is fine as long as buffer doesn't =
contain { or } in the wrong place....
Does this seem useful? I'm personally working on a template system and =
would find such a function very helpful. Not sure where to start if I =
was going to implement it - I downloaded the 1.9.2 source code but =
couldn't really find out where I'd add the code.
Kind regards,
Samuel=
I'm curious if anyone has considered a method called interpolate:
class String
def interpolate(binding, filename, lineno)
... magic ...
end
end
It would have a similar effect as %Q, but the input would already exist =
as a string rather than being parsed. This would avoid lots of escaping =
issues. i.e.
eval("%Q{" + buffer + "}") is fine as long as buffer doesn't =
contain { or } in the wrong place....
Does this seem useful? I'm personally working on a template system and =
would find such a function very helpful. Not sure where to start if I =
was going to implement it - I downloaded the 1.9.2 source code but =
couldn't really find out where I'd add the code.
Kind regards,
Samuel=