Class: Gotta::Run::Ruby::Runtime::Template
- Inherits:
-
Object
- Object
- Gotta::Run::Ruby::Runtime::Template
- Defined in:
- lib/gotta/run/ruby/runtime/template.rb
Instance Method Summary collapse
-
#initialize(variables: {}) ⇒ Template
constructor
A new instance of Template.
- #render(file) ⇒ Object
Constructor Details
#initialize(variables: {}) ⇒ Template
Returns a new instance of Template.
25 26 27 28 29 |
# File 'lib/gotta/run/ruby/runtime/template.rb', line 25 def initialize(variables: {}) variables.each do |var, value| instance_variable_set("@#{var}", value) end end |
Instance Method Details
#render(file) ⇒ Object
31 32 33 |
# File 'lib/gotta/run/ruby/runtime/template.rb', line 31 def render(file) ERB.new(File.read(file)).result(binding) end |