Sha256: 1b101a98498dfdf465db482197dae76d24d9937664f546deafcc48c127d756f2

Contents?: true

Size: 395 Bytes

Versions: 4

Compression:

Stored size: 395 Bytes

Contents

require 'mkit/utils'

module MKIt
  module ERBHelper
    def read_template(template)
      root = MKIt::Utils.root
      File.read("#{root}/lib/mkit/app/templates/#{template}.erb")
    end
  
    def parse_template(template, data = {})
       ERB.new(read_template(template)).result_with_hash(data)
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mkit-0.4.1 lib/mkit/app/helpers/erb_helper.rb
mkit-0.4.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.3.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.2.0 lib/mkit/app/helpers/erb_helper.rb