Using meta programming to add lines if a certain method is called : I'm writing a program and was wondering if there was a way for me to do the following thing with metaprogramming in ruby?

I want it so that whenever a method is called and the method is at the end of another method, that the method call is surrounded by a pair of lines. So the following method:

    def my_method
        do_some_stuff
        x = 1+1
        metaprogram_method
    end

Would be transformed into:

    def my_method
        do_some_stuff
        x = 1+1
        metaprogram_line_1
        metaprogram_method
        metaprogram_line_2
    end

I'm pretty new to ruby, and very new to metaprogramming so any help would be appreciated.
