13 lines
271 B
Ruby
13 lines
271 B
Ruby
|
class MyData
|
||
|
attr_accessor :val, :list
|
||
|
end
|
||
|
|
||
|
## any object can be a context object
|
||
|
mydata = MyData.new
|
||
|
mydata.val = 'Erubis Example'
|
||
|
mydata.list = ['aaa', 'bbb', 'ccc']
|
||
|
|
||
|
require 'erubis'
|
||
|
eruby = Erubis::Eruby.new(File.read('example5.eruby'))
|
||
|
puts eruby.evaluate(mydata)
|