> > Now I see that if I can transform all the <"a#{expression}c"> in <"a"
> > + (expression) + "c"> in a ruby source code string, I could change
> > expression with "a#{expression}c" in "a" + clever_stuff(expression) +
> > "c" and use my changed + method in Strings. Is there an easy way to
> > manipulate ruby code in ruby to do this?
>
> Maybe you can take a look at ParseTree to decompose a dynamic string
> into its components:
>
>   require "rubygems"
>   require "parse_tree"
>   class Foo
>     def foo
>       "interpolation: #{42}!"
>     end
>   end
>   ParseTree.new.parse_tree(Foo)
> => [[:class, :Foo, [:const, :Object], [:defn, :foo, [:scope, [:block,
> [:args], [:dstr, "interpolation: ", [:lit, 42], [:str, "!"]]]]]]]

Thanks!
I'll take a look at it.