Sha256: 7aba1471160157481c7f9c3ac992b0a774ace26f9ae96ba856cfd48e686a8e47

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

module Fastlane
  class ErbTemplateHelper
    require "erb"
    def self.load(template_name)
      path = "#{Fastlane::ROOT}/lib/assets/#{template_name}.erb"
      load_from_path(path)
    end

    def self.load_from_path(template_filepath)
      unless File.exist?(template_filepath)
        UI.user_error!("Could not find template at path '#{template_filepath}'")
      end
      File.read(template_filepath)
    end

    def self.render(template, template_vars_hash, trim_mode = nil)
      Fastlane::ErbalT.new(template_vars_hash, trim_mode).render(template)
    end
  end
  class ErbalT < OpenStruct
    def initialize(hash, trim_mode = nil)
      super(hash)
      @trim_mode = trim_mode
    end

    def render(template)
      ERB.new(template, nil, @trim_mode).result(binding)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fastlane_hotfix-2.165.1 fastlane/lib/fastlane/erb_template_helper.rb
fastlane_hotfix-2.165.0 fastlane/lib/fastlane/erb_template_helper.rb