Assuming I have the following proc:

a = Proc.new do
    puts "start"
    yield
    puts "end"
end

Also assuming I pass a to another method which subsequently calls instance_eval on another class with that block, how can I now pass a block onto the end of that method which gets yielded in a.

For example:

def do_something(a,&b)
    AnotherClass.instance_eval(&a) # how can I pass b to a here?
end

a = Proc.new do
    puts "start"
    yield
    puts "end"
end

do_something(a) do
    puts "this block is b!"
end

Output should of course should be:

start
this block is b!
end

How can I pass the secondary block to a in the instance_eval?

I need something like this for the basis of a Ruby templating system I'm working on.

Edit
Report