Created
February 4, 2012 15:13
-
-
Save cj/1738422 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 Padrino | |
| module Liquid | |
| module Helpers | |
| def render(engine, data=nil, options={}, locals={}, &block) | |
| ignored_ivs = [ | |
| '@default_layout', | |
| '@app', | |
| '@template_cache', | |
| '@env', | |
| '@request', | |
| '@response', | |
| '@params', | |
| '@_response_buffer', | |
| '@route', | |
| '@block_params', | |
| '@_content_type', | |
| '@current_ability', | |
| '@block_params', | |
| '@layout' | |
| ] | |
| user_ivs = [] | |
| self.instance_variables.to_s.gsub(/(\[|\]|:)/, '').split(', ').each do |key| | |
| user_ivs << key if not ignored_ivs.include? key | |
| end | |
| user_ivs.each do |iv| | |
| locals[iv[1..-1]] = self.instance_variable_get iv | |
| end | |
| super engine, data, options, locals, &block | |
| end | |
| end | |
| def self.registered(app) | |
| app.helpers Helpers | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment