Dry-view as SOAP templates renderer


I have a funny idea about using dry-view as SOAP templates renderer. I’m playing now with Tilt and I’ve been thinking about creating something like that(oh, yeah, I’m not using WSDL cause our industry does not respect them and they are usually out of date):

So, I have a few templates like that:

And I need to render them like this:


   <%=render_partial(registration, with: registration)%>


  registration.passengers.each do |p|
    <%=render_partial(passenger, p)%>



Well, it’s simplified version, there are tons of namespaces inside and so on.
The thing I wanna do is to precompile this template(merge this three partials into one xml, cut comments out of it, compress, process erb) and cache in memory(we are sending and rendering a tons of this docs over the net). I’ve been considering to write partial engine by hand and for caching I’ve been considering to just use Tilt::Cache. I hope this cache will help us to increase speed of our app.

Right now we have something like this:


To decrease time we are caching file like this:

temp = File.read(Rails.root.join("templates/#{@section}/#{@name}.xml.erb")).chomp.html_safe
GlobalCache["#{@section+@name}"] = temp

But this template is not precompiled and I believe we can gain a bit more out of cache.

The question is - can dry-view help me with this somehow, perhaps it has any caching facilities which are planned? Or you can give any advise or just criticise my idea :slight_smile:

P.S. I’m looking for Rails-free solution :wink: