Class: Buildserver::ErbTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/buildserver/erb_template.rb

Instance Method Summary collapse

Constructor Details

#initializeErbTemplate

Returns a new instance of ErbTemplate.



6
7
# File 'lib/buildserver/erb_template.rb', line 6

def initialize
end

Instance Method Details

#parse(template_file, vars) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/buildserver/erb_template.rb', line 9

def parse(template_file, vars)
  template_file.rewind
  template = template_file.read

  vars.each_pair do |key, value|
    instance_variable_set('@' + key.to_s, value)
  end

  ERB.new(template).result(binding)
end