handlers/kinetic_request_submission_format_answers_v1/handler/init.rb
# Builds and returns the results of interpreting the desired template String
# within the current context (IE exposing the @answers variable).
#
# This is a required method that is automatically called by the Kinetic Task
# Engine.
#
# ==== Returns
# An Xml formatted String representing the return variable results.
Builds and returns the results of interpreting the desired template String
within the current context .

This is a required method that is automatically called by the Kinetic Task
Engine.

Returns
An Xml formatted String representing the return variable results.
Builds and returns the results of interpreting the desired template String within the current context . This is a required method that is automatically called by the Kinetic Task Engine . Returns An Xml formatted String representing the return variable results .
def execute()
    template_string = DEFAULT_TEMPLATE
    begin
      template = ERB.new(template_string, nil, '<>')
      template.filename = "(Format Template)"
      result = template.result(binding)
    rescue Exception
      puts "A problem was encountered executing the formatting template:\n" <<
        "  Format Template:\n#{template_string.gsub(/^/,'    ')}\n" <<
        "  Backtrace:\n    #{$!.message}\n    #{$!.backtrace.join("\n    ")}"
    end
    <<-RESULTS
    <results>
      <result name="result">#{escape(result)}</result>
    </results>
    RESULTS
  end
def execute ( ) template_string = DEFAULT_TEMPLATE begin template = ERB . new ( template_string , nil , '<>' ) template . filename = "(Format Template)" result = template . result ( binding ) rescue Exception puts "A problem was encountered executing the formatting template:\n" << "  Format Template:\n#{template_string.gsub(/^/,'    ')}\n" << "  Backtrace:\n    #{$!.message}\n    #{$!.backtrace.join("\n    ")}" end <<-RESULTS 
    <results>
      <result name="result"> #{ escape ( result ) } </result>
    </results>
     RESULTS end
Builds and returns the results of interpreting the desired template String
within the current context (IE exposing the @answers variable).
Builds and returns the results of interpreting the desired template String within the current context ( IE exposing the @answers variable ) .
# Determine which template should be used to format the answers # Attempt to build the result # Initialize a new ERB template from the # Overwrite the template filename for help with debugging.  This will # prefix any error backtraces with (Format Template) rather than the more # ambiguous (erb). # Use the current binding (which represents the Ruby context to execute # the template within).  By setting it to the binding of this method, it # will have access to the @answers variables generated in the initialize # method. # If there was a problem building the result # Output the error in a clean, easy to interpret manner # Return the results String