Close

Foreman – Render provisioning templates

#!/usr/bin/env ruby

require "erb"
require 'ostruct'

class Basicerb

def initialize name
@name = name
@template = File.read('/root/index.erb')
end

def render
@person = OpenStruct.new
@person.name = "John Smith"
@person.age = 70
@person.pension = 300
ERB.new("

Hello ERB World!!

<%= @person.name %>

").result( binding )
end
end

test = Basicerb.new "wow"

puts test.render