Sha256: 311695b04cf6408334b3d21dc0daaee411791fb39991c1785398a22e1beb0b81
Contents?: true
Size: 716 Bytes
Versions: 1
Compression:
Stored size: 716 Bytes
Contents
module WirecardSepa module Utils class Template attr_reader :request def initialize(request) @request = request end def to_xml xml_template = File.read template_path xml_template.gsub /{{\w+}}/, request_params end private def request_params request.params.each_with_object({}) do |(k,v), h| h["{{#{k.upcase}}}"] = v end end def template_path File.expand_path "../../../templates/#{template_file}", __FILE__ end def template_file request.class.name. gsub(/(.)([A-Z])/, '\1_\2'). gsub('::_', '/'). downcase + '.xml' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wirecard_sepa-0.0.1 | lib/wirecard_sepa/utils/template.rb |