-
-
Save chriseppstein/236232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module WithLayout | |
| def with_layout(layout) | |
| @layout = layout | |
| yield | |
| ensure | |
| @layout = nil | |
| end | |
| def get(*args) | |
| options = args.last.is_a?(Hash) ? args.pop : {} | |
| options[:layout] ||= @layout | |
| args << options | |
| super | |
| end | |
| end | |
| Sinatra::Base.extend WithLayout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment