lib/erbook/template.rb
##
# Renders this template within a fresh sandbox that is populated with
# the given instance variables, whose names must be prefixed with '@'.
#
Renders this template within a fresh sandbox that is populated with
the given instance variables, whose names must be prefixed with '@'.
Renders this template within a fresh sandbox that is populated with the given instance variables whose names must be prefixed with ' @ ' .
def render_with inst_vars = {}
      old_sandbox = @sandbox
      begin
        @sandbox = Sandbox.new
        inst_vars.each_pair do |var, val|
          @sandbox.instance_variable_set var, val
        end
        render
      ensure
        @sandbox = old_sandbox
      end
    end
def render_with inst_vars = { } old_sandbox = @sandbox begin @sandbox = Sandbox . new inst_vars . each_pair do | var , val | @sandbox . instance_variable_set var , val end render ensure @sandbox = old_sandbox end end
Renders this template within a fresh sandbox that is populated with
the given instance variables, whose names must be prefixed with '@'.
Renders this template within a fresh sandbox that is populated with the given instance variables whose names must be prefixed with ' @ ' .
inst_vars