Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/bldr/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Node

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

# List of bldr public api method. So we don't overwrite them when we do
# crazy ruby metaprogramming when we build nodes.
Expand Down Expand Up @@ -314,7 +315,7 @@ def template(template, options={})
#
# @param [Object] object The object to copy instance variables from.
def copy_instance_variables(object)
ivar_names = (object.instance_variables - PROTECTED_IVARS).map(&:to_s)
ivar_names = (object.instance_variables - PROTECTED_IVARS - SINATRA_IVARS).map(&:to_s)
ivar_names.map do |name|
instance_variable_set(name, object.instance_variable_get(name))
end
Expand Down
5 changes: 5 additions & 0 deletions lib/bldr/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def prepare
def precompiled_template(locals)
data.to_s
end

protected
def compiled_method(locals_keys)
compile_template_method(locals_keys)
end
end

Tilt.register 'bldr', Bldr::Template
Expand Down