Module: MKIt::ERBHelper

Included in:
Pod, Service
Defined in:
lib/mkit/app/helpers/erb_helper.rb

Instance Method Summary collapse

Instance Method Details

#parse_model(template) ⇒ Object



16
17
18
# File 'lib/mkit/app/helpers/erb_helper.rb', line 16

def parse_model(template)
  ERB.new(read_template(template))
end

#parse_template(template, data = {}) ⇒ Object



12
13
14
# File 'lib/mkit/app/helpers/erb_helper.rb', line 12

def parse_template(template, data = {})
  ERB.new(read_template(template)).result_with_hash(data)
end

#read_template(template) ⇒ Object



7
8
9
10
# File 'lib/mkit/app/helpers/erb_helper.rb', line 7

def read_template(template)
  root = MKIt::Utils.root
  File.read("#{root}/lib/mkit/app/templates/#{template}.erb")
end