instiki/vendor/plugins/erubis/test/data/users-guide/main_program1.rb
2010-07-04 08:51:53 -05:00

8 lines
344 B
Ruby

require 'erubis'
eruby = Erubis::Eruby.new(File.read('template1.rhtml'))
items = ['foo', 'bar', 'baz']
x = 1
## local variable 'x' and 'eruby' are passed to template as well as 'items'!
print eruby.result(binding())
## local variable 'x' is changed unintendedly because it is changed in template!
puts "** debug: x=#{x.inspect}" #=> "baz"