Class: Gotta::Run::Ruby::Runtime::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/gotta/run/ruby/runtime/template.rb

Instance Method Summary collapse

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