Class: CI::ConfigHelper::ConfigTemplate
- Inherits:
-
Object
- Object
- CI::ConfigHelper::ConfigTemplate
- Includes:
- ERB::Util
- Defined in:
- lib/source/helpers.rb
Instance Method Summary collapse
-
#initialize(template, options = {}) ⇒ ConfigTemplate
constructor
A new instance of ConfigTemplate.
- #render ⇒ Object
- #to_s ⇒ Object
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, ={}) .each do |k, v| instance_variable_set("@#{k}", v) end @erb = ERB.new(File.read(template)) end |
Instance Method Details
#render ⇒ Object
29 30 31 |
# File 'lib/source/helpers.rb', line 29 def render @erb.result(binding) end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/source/helpers.rb', line 33 def to_s render end |