Class: CI::ConfigHelper::ConfigTemplate

Inherits:
Object
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/source/helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(template, options = {}) ⇒ ConfigTemplate

Returns a new instance of ConfigTemplate.



22
23
24
25
26
27
# File 'lib/source/helpers.rb', line 22

def initialize(template, options={})
  options.each do |k, v|
    instance_variable_set("@#{k}", v)
  end
  @erb = ERB.new(File.read(template))
end

Instance Method Details

#renderObject



29
30
31
# File 'lib/source/helpers.rb', line 29

def render
  @erb.result(binding)
end

#to_sObject



33
34
35
# File 'lib/source/helpers.rb', line 33

def to_s
  render
end