cjstehno / ersatz

🤖 A simulated HTTP server for testing client code with configurable responses.
https://cjstehno.github.io/ersatz
Apache License 2.0
47 stars 5 forks source link

carry over the top level closure's owner #111

Closed musketyr closed 5 years ago

musketyr commented 5 years ago

when there are nested closures as a part of the DSL the DSL users still expect the owner is the owner of the very first closure (the surrounding object) not the n-1 closure.

feel free to use https://github.com/jasanspace/groovy-closure-support

I'm working on a series about Groovy Builders where I'm explaining this more thoroughly but it is not available yet.

cjstehno commented 5 years ago

I changed stuff in the last release to delegate first, which probably caused this issue. I'll read your suggestions since I've never run into a good solution for the scoping issue. Thanks.