instiki/vendor/plugins/erubis-2.6.5/test/data/users-guide/example5.rb

17 lines
443 B
Ruby
Raw Normal View History

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