Sha256: 1feee302e32d0eb58759f59b617d7bf993d2b43988fa080b987104925ae4513d

Contents?: true

Size: 231 Bytes

Versions: 29

Compression:

Stored size: 231 Bytes

Contents

require 'erb'

class Template
  def initialize(variables: {})
    variables.each do |var, value|
      instance_variable_set("@#{var}", value)
    end
  end

  def render(file)
    ERB.new(File.read(file)).result(binding)
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
faastruby-0.5.29 templates/ruby/web-root/template.rb
faastruby-0.5.28 templates/ruby/web-root/template.rb
faastruby-0.5.27 templates/ruby/web-root/template.rb
faastruby-0.5.26 templates/ruby/web-root/template.rb
faastruby-0.5.25 templates/ruby/web-root/template.rb
faastruby-0.5.24 templates/ruby/web-root/template.rb
faastruby-0.5.23 templates/ruby/web-root/template.rb
faastruby-0.5.22 templates/ruby/web-root/template.rb
faastruby-0.5.21 templates/ruby/web-root/template.rb
faastruby-0.5.20 templates/ruby/web-root/template.rb
faastruby-0.5.19 templates/ruby/web-root/template.rb
faastruby-0.5.18 templates/ruby/web-root/template.rb
faastruby-0.5.17 templates/ruby/web-root/template.rb
faastruby-0.5.16 templates/ruby/web-root/template.rb
faastruby-0.5.15 templates/ruby/web-root/template.rb
faastruby-0.5.14 templates/ruby/web-root/template.rb
faastruby-0.5.13 templates/ruby/web-root/template.rb
faastruby-0.5.12 templates/ruby/web-root/template.rb
faastruby-0.5.11 templates/ruby/web-root/template.rb
faastruby-0.5.10 templates/ruby/web-root/template.rb