Sha256: 2d98d37c8a6cb0a49fe709eef6a1d95a87f75ddf5fce7e147eebb414e3e2c374

Contents?: true

Size: 423 Bytes

Versions: 12

Compression:

Stored size: 423 Bytes

Contents

# frozen_string_literal: true

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

12 entries across 12 versions & 1 rubygems

Version Path
mkit-0.9.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.8.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.7.2 lib/mkit/app/helpers/erb_helper.rb
mkit-0.7.1 lib/mkit/app/helpers/erb_helper.rb
mkit-0.7.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.6.3 lib/mkit/app/helpers/erb_helper.rb
mkit-0.6.2 lib/mkit/app/helpers/erb_helper.rb
mkit-0.6.1 lib/mkit/app/helpers/erb_helper.rb
mkit-0.6.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.5.0 lib/mkit/app/helpers/erb_helper.rb
mkit-0.4.3 lib/mkit/app/helpers/erb_helper.rb
mkit-0.4.2 lib/mkit/app/helpers/erb_helper.rb