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

16 lines
443 B
Ruby

require 'erubis'
input = File.read('example5.eruby')
eruby = Erubis::Eruby.new(input) # create Eruby object
## create context object
## (key means var name, which may be string or symbol.)
context = {
:val => 'Erubis Example',
'list' => ['aaa', 'bbb', 'ccc'],
}
## or
# context = Erubis::Context.new()
# context['val'] = 'Erubis Example'
# context[:list] = ['aaa', 'bbb', 'ccc'],
puts eruby.evaluate(context) # get result