Created
December 19, 2013 14:40
-
-
Save sbrauer/8040112 to your computer and use it in GitHub Desktop.
Notes parameters to most recent call to Sinatra::Template.render and exposes them via #last_render.
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
require 'sinatra' | |
module Sinatra | |
module Templates | |
@@last_render = {} | |
alias_method :orig_render, :render | |
def render(engine, data, options={}, locals={}, &block) | |
@@last_render[:engine] = engine | |
@@last_render[:data] = data | |
@@last_render[:options] = options.clone | |
@@last_render[:locals] = locals.clone | |
orig_render(engine, data, options, locals, &block) | |
end | |
def self.last_render | |
@@last_render | |
end | |
end | |
end | |
def last_render | |
Sinatra::Templates.last_render | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment