How would you feel about replacing this intermediate variable with a call to `#tap`? Its more of a style choice, but its one I've been preferring lately for this method like this.

```rb
modules << constant_in(modules.last, to_const(namespace)).tap { |mod| mod.module_exec { extend self } }
```

Which brings me to my next point, where I personally, would still prefer to have the `mod.module_exec { extend self }` call to be wrapped in a method. It would make a one liner more readable and its a lot more intent revealing for people who may not know that ruby trick just yet.