Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Forked from tdreyno/meta.rb
Created November 16, 2009 19:09
Show Gist options
  • Select an option

  • Save chriseppstein/236232 to your computer and use it in GitHub Desktop.

Select an option

Save chriseppstein/236232 to your computer and use it in GitHub Desktop.
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