wycats (owner)

Revisions

gist: 228333 Download_button fork
public
Public Clone URL: git://gist.github.com/228333.git
Embed All Files: show embed
every_request.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    def evaluate(scope, locals, &block)
      source, offset = local_assignment_code(locals)
      source = [source, template_source].join("\n")
 
      original_out_buf =
        scope.instance_variables.any? { |var| var.to_sym == :@_out_buf } &&
        scope.instance_variable_get(:@_out_buf)
 
      scope.instance_eval source, eval_file, line - offset
 
      output = scope.instance_variable_get(:@_out_buf)
      scope.instance_variable_set(:@_out_buf, original_out_buf)
 
      output
    end