Method: PSRP::MessageEncoder#render

Defined in:
lib/wsmv/psrp_message.rb

#render(template, context = nil) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Renders the specified template with the given context

Parameters:

  • template (String)

    The base filename of the PSRP message template.

  • context (Hash) (defaults to: nil)

    Any options required for rendering the template.

Returns:

  • (String)

    The rendered XML PSRP message.



203
204
205
206
207
208
# File 'lib/wsmv/psrp_message.rb', line 203

def render(template, context = nil)
  template_path = File.expand_path(
    "#{File.dirname(__FILE__)}/templates/#{template}.xml.erb")
  template = File.read(template_path)
  Erubis::Eruby.new(template).result(context)
end