~ubuntu-branches/ubuntu/saucy/ruby-erubis/saucy

« back to all changes in this revision

Viewing changes to test/data/users-guide/example1.rb

  • Committer: Package Import Robot
  • Author(s): Laurent Bigonville
  • Date: 2012-01-26 15:15:58 UTC
  • Revision ID: package-import@ubuntu.com-20120126151558-9u7mnf9ooqnw3bwz
Tags: upstream-2.7.0
ImportĀ upstreamĀ versionĀ 2.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'erubis'
 
2
input = File.read('example1.eruby')
 
3
eruby = Erubis::Eruby.new(input)    # create Eruby object
 
4
 
 
5
puts "---------- script source ---"
 
6
puts eruby.src                      # print script source
 
7
 
 
8
puts "---------- result ----------"
 
9
list = ['aaa', 'bbb', 'ccc']
 
10
puts eruby.result(binding())        # get result
 
11
## or puts eruby.result(:list=>list)  # or pass Hash instead of Binding
 
12
 
 
13
## # or
 
14
## eruby = Erubis::Eruby.new
 
15
## input = File.read('example1.eruby')
 
16
## src = eruby.convert(input)
 
17
## eval src