feature request: builder append(...) or insert(...) #2

wstidolph opened this Issue Aug 3, 2011 · 1 comment

2 participants


I'd like to be able to append nodes to the TropoBuilder, or to insert an existing TropoBuilder's nodes into a new Builder; I would have expected this somewhere directly in BuilderSupport, but I don't see it so I'll ask you if it's easy for the TropoBuilder ;) or if maybe I just missed it ...

Here's a use case I need to handle:

(in a grails controller)

TropoBuilder tb = new TropoBuilder();
tb.append {

def someLogic(TroboBuilder tb){

Another approach would be to support something like:

TropoBuilder tb1 = new TopoBuilder()
 tb1.tropo { say('goodbye') }

TropoBuilder tb2 = new TopoBuilder()
 tb2.tropo {

(I find the second approach a bit more flexible)

I ran into this need specifically while building Tropo commands in state machine actions using the http://grails.org/plugin/fsm FSM plugin, because it uses the 'on' keyword. So, when I use an action block in the FSM to generate a tropo builder and when put 'on' into blocks inside the action definition of the state machine, they vanish from the tropo output! But, it's a more general issue of wanting to assemble complex tropo commands one chunk at a time.

@mpermar mpermar added a commit that closed this issue Aug 4, 2011
@mpermar mpermar Added new append method to TropoBuilder which allows to create more
complex builders by appending existing builder objects.

This closes #2
@mpermar mpermar closed this in 07bb766 Aug 4, 2011
Tropo member

Hi Wayne,

I think you already could do what you wanted if you don't use the closure format. Like for example here in the tests:


But anyways, I added support for explicitly embedding other builders, so now you can add an append(builder) element within another builder.

You can find an example here:


This is available in version 0.1.2 of the plugin, or you can pick the changes from the source tree.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment