I would like to get a tree of the enclosing methods for this method. Here is my code (with hopefully descriptive comments):
enclosing_method(var1,var2) do
    enclosing_method(var3,var4) do
        get_tree # This method should return an array of it's enclosing methods
        # e.g. [get_tree, enclosing_method, enclosing_method, main]
    end
end
How can I do this? If this is unclear please let me know, I'm having trouble wording my question. Also, my title is bad as well. If anyone can think of a better title please suggest it in comments.
EDIT:
I learned from @WandMaker's answer comment that nested methods are not possible. So, I am semi changing the question. What about:
class Myclass
    @@all_instances
    def initialize
        @parents = get_tree # method that will return
        # all of the containing instances / anythings
        @content = yield
        @@all_instances << self
    end
    attr_reader :content
    attr_reader :parents
end
Myclass.new do
    Myclass.new do
        # bonus points if you make this possible!
        # I don't really need this to work but
        # it's a kewl thing so please try
        get_tree # => [Myclass, Myclass, <main>]
    end
end
What I am looking for is what the method get_tree would have to be to have the following outputs:
> Myclass.all_instances[0].parents # => [<main>]
> Myclass.all_instances[1].parents # => [Myclass, <main>]
Lemme know in comments if this is confusing or in any way nonsensical. I will fix it. I promise. Thanks to all you geniuses in advance for figuring this out. I am eternally grateful.