From: Andrew Chen Date: 2008-02-22T06:14:56+09:00 Subject: Re: Where does instance_eval _magically_ set the variable to? Todd, There are some subtle difference between load and instance_eval. In this case, instance_eval works, the load doesn't. I still have no idea where the instance_eval put the variables at. >cat param.txt name="John" >cat tmpl.txt my name is: <%= name %> >cat erb_instance_eval.rb #!/usr/bin/env ruby require 'erb' instance_eval(File.read("param.txt")) #load "param.txt" puts ERB.new(File.read("tmpl.txt")).result(binding) >./erb_instance_eval.rb my name is: John >cat erb_load.rb #!/usr/bin/env ruby require 'erb' #instance_eval(File.read("param.txt")) load "param.txt" puts ERB.new(File.read("tmpl.txt")).result(binding) >./erb_load.rb (erb):1: undefined local variable or method `name' for main:Object (NameError) from ./erb_load.rb:7 > Also, the load_yaml won't work, because I need to setup variables dynamically. Thanks ~Andrew Chen