Skip to content
Browse files

Still tweaking variable exchange methods

  • Loading branch information...
1 parent b9e387e commit 0ca099892337ed313daf1065e223645ccd152958 @forrest committed Jan 22, 2012
View
10 lib/prawnto/template_handlers/renderer.rb
@@ -48,10 +48,14 @@ def method_missing(m, *args)
pdf.send(m, *args)
elsif @calling_object.respond_to?(m.to_s)
push_instance_variables_to @calling_object
- @calling_object.send(m, *args)
+ res = @calling_object.send(m, *args)
+ copy_instance_variables_from @calling_object
+ res
elsif @calling_object != @view_context and @view_context.respond_to?(m.to_s)
- push_instance_variables_to @calling_object
- @view_context.send(m, *args)
+ push_instance_variables_to @view_context
+ res = @view_context.send(m, *args)
+ copy_instance_variables_from @view_context
+ res
else
raise
end
View
5 spec/dummy/app/helpers/application_helper.rb
@@ -6,4 +6,9 @@ def some_helper
def x_output_helper
@x.to_s
end
+
+ def set_x_to_3_in_helper
+ @x = 3
+ end
+
end
View
7 spec/dummy/app/views/test/complex.pdf.prawn
@@ -6,3 +6,10 @@ text x_output_helper
if @x.to_s != x_output_helper
raise "Variable did not carry over"
end
+
+set_x_to_3_in_helper
+
+if @x != 3
+ raise "Variable did not carry over"
+end
+

0 comments on commit 0ca0998

Please sign in to comment.
Something went wrong with that request. Please try again.