Sha256: 0f3b38db8828121084385c872082f7d6ba433df81ff781d8ffe140c5f63f875e
Contents?: true
Size: 575 Bytes
Versions: 1
Compression:
Stored size: 575 Bytes
Contents
# frozen_string_literal: true module ArchivesSpace module Template def self.list Dir.glob File.join(templates_path, "*.erb") end def self.process(template, data) t = ERB.new(read(template)) r = t.result(binding).squeeze("\n") JSON.parse(r).to_json end def self.read(file) File.read("#{templates_path}/#{file}.json.erb") end def self.templates_path ENV.fetch( "ARCHIVESSPACE_CLIENT_TEMPLATES_PATH", File.join(File.dirname(File.expand_path(__FILE__)), "templates") ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
archivesspace-client-0.2.0 | lib/archivesspace/client/template.rb |