Skip to content

Commit 182ac56

Browse files
committed
Don't copy over most sinatra instance variables
1 parent dc95adf commit 182ac56

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/bldr/node.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Node
77

88
# These do not get copied into child nodes. All other instance variables do.
99
PROTECTED_IVARS = [:@current_object, :@result, :@parent, :@opts, :@views, :@locals]
10+
SINATRA_IVARS = [:@default_layout, :@app, :@template_cache, :@env, :@response]
1011

1112
# List of bldr public api method. So we don't overwrite them when we do
1213
# crazy ruby metaprogramming when we build nodes.
@@ -314,7 +315,7 @@ def template(template, options={})
314315
#
315316
# @param [Object] object The object to copy instance variables from.
316317
def copy_instance_variables(object)
317-
ivar_names = (object.instance_variables - PROTECTED_IVARS).map(&:to_s)
318+
ivar_names = (object.instance_variables - PROTECTED_IVARS - SINATRA_IVARS).map(&:to_s)
318319
ivar_names.map do |name|
319320
instance_variable_set(name, object.instance_variable_get(name))
320321
end

0 commit comments

Comments
 (0)